Fix build and run issues
All checks were successful
CI / Go tests & lint (push) Successful in 8s
CI / Frontend tests & type-check (push) Successful in 40s
CI / Go tests & lint (pull_request) Successful in 7s
CI / Frontend tests & type-check (pull_request) Successful in 35s

This commit is contained in:
2026-04-08 14:58:58 -03:00
parent 9905234b34
commit e82a39f2e4
7 changed files with 34 additions and 29 deletions

View File

@@ -14,7 +14,7 @@ type Notification struct {
ID int64 `json:"id"`
VolunteerID int64 `json:"volunteer_id"`
Message string `json:"message"`
Read bool `json:"read"`
Read bool `json:"is_read"`
CreatedAt time.Time `json:"created_at"`
}
@@ -42,7 +42,7 @@ func (s *Store) GetByID(ctx context.Context, id int64) (*Notification, error) {
n := &Notification{}
var createdAt string
err := s.db.QueryRowContext(ctx,
`SELECT id, volunteer_id, message, read, created_at FROM notifications WHERE id = ?`, id,
`SELECT id, volunteer_id, message, is_read, created_at FROM notifications WHERE id = ?`, id,
).Scan(&n.ID, &n.VolunteerID, &n.Message, &n.Read, &createdAt)
if errors.Is(err, sql.ErrNoRows) {
return nil, ErrNotFound
@@ -56,7 +56,7 @@ func (s *Store) GetByID(ctx context.Context, id int64) (*Notification, error) {
func (s *Store) ListForVolunteer(ctx context.Context, volunteerID int64) ([]Notification, error) {
rows, err := s.db.QueryContext(ctx,
`SELECT id, volunteer_id, message, read, created_at FROM notifications WHERE volunteer_id = ? ORDER BY created_at DESC`,
`SELECT id, volunteer_id, message, is_read, created_at FROM notifications WHERE volunteer_id = ? ORDER BY created_at DESC`,
volunteerID,
)
if err != nil {
@@ -85,7 +85,7 @@ func (s *Store) CreateNotification(ctx context.Context, volunteerID int64, messa
func (s *Store) MarkRead(ctx context.Context, id, volunteerID int64) (*Notification, error) {
result, err := s.db.ExecContext(ctx,
`UPDATE notifications SET read = 1 WHERE id = ? AND volunteer_id = ?`,
`UPDATE notifications SET is_read = 1 WHERE id = ? AND volunteer_id = ?`,
id, volunteerID,
)
if err != nil {