BeechCMS / @beechcms/core / INotificationRepository
Interface: INotificationRepository
Methods
create()
create(
record):Promise<string>
Insert a new notification and return its generated id so callers (e.g. the public form submission flow) can correlate the notification with the triggering request. With dedupeKey, a repeated key stores nothing and returns the id of the notification the first call created.
Parameters
record
Returns
Promise<string>
delete()
delete(
notificationId):Promise<boolean>
Resolve false when no notification has this id, so the caller can answer 404.
Parameters
notificationId
string
Returns
Promise<boolean>
list()
list(
limit):Promise<NotificationRecord[]>
Return the most recent notifications, newest first.
The limit parameter is required to prevent unbounded reads — the inbox could grow large over time and clients only ever render a window.
Parameters
limit
number
Returns
Promise<NotificationRecord[]>
markAllRead()
markAllRead():
Promise<void>
Returns
Promise<void>
markRead()
markRead(
notificationId):Promise<boolean>
Resolve false when no notification has this id, so the caller can answer 404.
Parameters
notificationId
string
Returns
Promise<boolean>
markUnread()
markUnread(
notificationId):Promise<boolean>
Resolve false when no notification has this id, so the caller can answer 404.
Parameters
notificationId
string
Returns
Promise<boolean>