Skip to content

DEV - create notifications when a grant is created + edit notification backend route #171

@lyannne

Description

@lyannne

Description: Currently, notifications are not being created for any grants. The goal of this ticket is to make sure notifications are automatically generated and stored in the database whenever a grant is created or edited. Each grant should automatically generate notifications for 2 weeks, 1 week, and 3 days before both the application deadline and each report deadline. When grant deadlines are edited or added, the notifications should also be updated or recreated accordingly.

Instructions:

  • Use the existing Notification entity and type definition from the middleware (Notification.ts):
  • In the grant creation route (POST /grants/new-grant):
    • Automatically create notification entries for 2 weeks, 1 week, and 3 days before each of:
      • Application deadline
      • Each report deadline
    • Use the existing notification POST route to create them.
  • In the grant edit route (PUT /grants/:id):
    • If any deadlines are modified or added, automatically update or recreate corresponding notifications. This requires a new edit notification route in the backend.

Acceptance Criteria

  • When a grant is created, notification records are automatically generated for all relevant deadlines.
  • Each notification is stored in the database with the proper alertTime, userId, and message.
    • Message should be descriptive (e.g., “Report due in 3 days for [Grant Name]”)
  • Editing a grant (application or report deadlines) updates or recreates corresponding notifications.
  • A new PUT /notifications/:id or equivalent route exists to edit/update notifications.
    • No duplicate notifications are created when a grant is edited without date changes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions