Constructor
new NotificationRepository(database, eventRepo)
Parameters:
Name | Type | Description |
---|---|---|
database |
Object | The database connection used for accessing notification data. |
eventRepo |
EventRepository | An instance of EventRepository for event-related operations. |
Methods
(static) addNotification(notification) → {Promise.<string>}
Adds a new notification to the database.
Parameters:
Name | Type | Description |
---|---|---|
notification |
Object | The notification object to add. |
Returns:
A promise that resolves to the ID of the newly added notification.
- Type
- Promise.<string>
(static) getAllNotifications() → {Promise.<Array.<Object>>}
Retrieves all notifications from the database.
Returns:
A promise that resolves to an array of notification objects.
- Type
- Promise.<Array.<Object>>
(static) getListOfNotifications(listOfNotificationIds) → {Promise.<Array.<Object>>}
Retrieves a list of notifications by their IDs.
Parameters:
Name | Type | Description |
---|---|---|
listOfNotificationIds |
Array.<string> | An array of notification IDs. |
Returns:
A promise that resolves to an array of notification objects.
- Type
- Promise.<Array.<Object>>
(static) getNotification(id) → {Promise.<Object>}
Retrieves a single notification by its ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the notification to retrieve. |
Returns:
A promise that resolves to the notification object.
- Type
- Promise.<Object>
(static) getNotificationById(id) → {Promise.<Object>}
Retrieves a notification by its ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the notification to retrieve. |
Returns:
A promise that resolves to the notification object.
- Type
- Promise.<Object>
(static) removeNotification(id) → {Promise.<void>}
Removes a notification from the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the notification to be removed. |
Returns:
- Type
- Promise.<void>
(static) update(id) → {Promise.<Object>}
Updates a notification's data in the database.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The ID of the notification to update. |
Returns:
A promise that resolves to the updated notification object.
- Type
- Promise.<Object>
(static) updateNoti(notiId, obj) → {Promise.<void>}
Updates specific fields of a notification in the database.
Parameters:
Name | Type | Description |
---|---|---|
notiId |
string | The ID of the notification to update. |
obj |
Object | The object containing updated fields for the notification. |
Returns:
- Type
- Promise.<void>