-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Location: backend/src/notifications/providers/create-notification.provider.ts
Description
Other modules — bookings, payments, invoices — need a simple way to create in-app notifications for a member after key events. This provider exposes a single notify() method that any module can call to persist a notification record. It has no HTTP endpoint — it is a purely internal service.
Because this provider will be called from outside the NotificationsModule (e.g. from BookingsModule and PaymentsModule), it must be exported from NotificationsModule so it can be injected as a dependency in those modules.
Acceptance Criteria
- A
CreateNotificationProviderclass is created atbackend/src/notifications/providers/create-notification.provider.ts - The provider exposes a
notify(userId: string, type: NotificationType, title: string, message: string): Promise<Notification>method - The method creates and saves a
Notificationrecord and returns it - All notification creation calls are fire-and-forget — callers should wrap calls with
.catch(() => void 0)so a failed notification never breaks the calling flow -
CreateNotificationProvideris registered inNotificationsModuleproviders and exported so it can be injected in other modules -
NotificationsModuleis imported into the following modules soCreateNotificationProvideris available:backend/src/bookings/bookings.module.tsbackend/src/payments/payments.module.ts
- The provider is wired up with fire-and-forget calls at the following trigger points (alongside the existing email calls in those providers):
create-booking.provider.ts→BOOKING_CREATED—"Booking Created"/"Your booking for <workspace> has been received and is pending confirmation."cancel-booking.provider.ts→BOOKING_CANCELLED—"Booking Cancelled"/"Your booking for <workspace> has been cancelled."handle-webhook.provider.ts(charge.success) →PAYMENT_SUCCESS—"Payment Successful"/"Your payment of ₦<amount> for <workspace> was successful."handle-webhook.provider.ts(charge.failed) →PAYMENT_FAILED—"Payment Failed"/"Your payment of ₦<amount> could not be processed. Please try again."
-
npx tsc --noEmitpasses with no errors
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers