In-App Notifications
Overview
Section titled “Overview”The notification system delivers in-app notifications to users about events relevant to them: application status changes, new applications on their gigs, and event reminders.
Notification Types
Section titled “Notification Types”| Type | Recipient | Trigger |
|---|---|---|
| APPLICATION_RECEIVED | Gig owner | A user applies to their gig |
| APPLICATION_ACCEPTED | Applicant | Gig owner accepts their application |
| APPLICATION_REJECTED | Applicant | Gig owner rejects their application |
| GIG_COMPLETED | Accepted applicants | Gig moves to COMPLETED status |
| EVENT_REMINDER | User with saved event | Event starts within a configurable window (default 24 hours) |
| NEW_FOLLOWER | Followed user | A user follows them |
Behaviors
Section titled “Behaviors”Notification Creation
Section titled “Notification Creation”Notifications are created by the system in response to specific events (not by users directly). Each notification has a referenceId and referenceType linking to the entity that triggered it.
Notification Read
Section titled “Notification Read”GET /notificationsreturns the authenticated user’s notifications, ordered by createdAt descending. Supports pagination and anunreadfilter.GET /notifications/unread-countreturns the count of unread notifications.
Mark as Read
Section titled “Mark as Read”PATCH /notifications/:idwith{ read: true }marks a single notification as read.POST /notifications/mark-all-readmarks all of the user’s notifications as read.
Event Reminder Trigger
Section titled “Event Reminder Trigger”A scheduled Cloudflare Worker cron trigger runs every hour. It queries events starting within the next 24 hours that have not yet triggered a reminder. For each such event, it creates an EVENT_REMINDER notification for every user who has that event in a collection. Each event triggers at most one reminder per user (tracked to prevent duplicates).
Notification Delivery
Section titled “Notification Delivery”Notifications are stored in the database. The frontend polls GET /notifications/unread-count every 60 seconds to check for new notifications. There is no real-time push (no WebSocket).
Scenarios
Section titled “Scenarios”S-NOTIF-1: Application received notification
Section titled “S-NOTIF-1: Application received notification”GIVEN user B applies to gig G owned by user ATHEN user A receives a notification with type APPLICATION_RECEIVEDAND referenceId = the application IDAND referenceType = "application"S-NOTIF-2: Application accepted notification
Section titled “S-NOTIF-2: Application accepted notification”GIVEN user A accepts user B's application to gig GTHEN user B receives a notification with type APPLICATION_ACCEPTEDAND referenceId = the application IDS-NOTIF-3: Application rejected notification
Section titled “S-NOTIF-3: Application rejected notification”GIVEN user A rejects user B's application to gig GTHEN user B receives a notification with type APPLICATION_REJECTEDS-NOTIF-4: List notifications
Section titled “S-NOTIF-4: List notifications”GIVEN user A has 10 notifications (3 unread)WHEN user A sends GET /notificationsTHEN the response contains 10 notifications ordered by createdAt descendingS-NOTIF-5: Filter unread notifications
Section titled “S-NOTIF-5: Filter unread notifications”GIVEN user A has 10 notifications (3 unread)WHEN user A sends GET /notifications?unread=trueTHEN the response contains 3 unread notificationsS-NOTIF-6: Unread count
Section titled “S-NOTIF-6: Unread count”GIVEN user A has 3 unread notificationsWHEN user A sends GET /notifications/unread-countTHEN the response is { count: 3 }S-NOTIF-7: Mark single notification as read
Section titled “S-NOTIF-7: Mark single notification as read”GIVEN user A has unread notification NWHEN user A sends PATCH /notifications/N with { read: true }THEN notification N's read field is trueS-NOTIF-8: Mark all as read
Section titled “S-NOTIF-8: Mark all as read”GIVEN user A has 5 unread notificationsWHEN user A sends POST /notifications/mark-all-readTHEN all 5 notifications have read = trueS-NOTIF-9: Gig completed notification
Section titled “S-NOTIF-9: Gig completed notification”GIVEN gig G moves to COMPLETED statusAND user B and user C have accepted applications on gig GTHEN user B receives a notification with type GIG_COMPLETEDAND user C receives a notification with type GIG_COMPLETEDS-NOTIF-10: Cannot read another user’s notifications
Section titled “S-NOTIF-10: Cannot read another user’s notifications”GIVEN user A has notification NWHEN user B sends PATCH /notifications/N with { read: true }THEN the API responds with 404 Not FoundS-NOTIF-11: Event reminder notification
Section titled “S-NOTIF-11: Event reminder notification”GIVEN user A has event E (startAt in 12 hours) in a collectionWHEN the reminder cron runsTHEN user A receives a notification with type EVENT_REMINDERAND referenceId = event E's idAND referenceType = EVENTS-NOTIF-12: Event reminder not duplicated
Section titled “S-NOTIF-12: Event reminder not duplicated”GIVEN user A already received an EVENT_REMINDER for event EWHEN the reminder cron runs againTHEN no duplicate notification is createdS-NOTIF-13: Gig completed does not notify rejected applicants
Section titled “S-NOTIF-13: Gig completed does not notify rejected applicants”GIVEN gig G moves to COMPLETED statusAND user B has a REJECTED application and user C has a PENDING applicationTHEN user B does not receive a GIG_COMPLETED notificationAND user C does not receive a GIG_COMPLETED notificationS-NOTIF-14: New follower notification
Section titled “S-NOTIF-14: New follower notification”GIVEN user A follows user BTHEN user B receives a notification with type NEW_FOLLOWERAND referenceId = user A's idAND referenceType = USER