MED-198: add notification for new analysis result
This commit is contained in:
@@ -50,4 +50,13 @@ class NotificationsApi {
|
||||
createNotification(params: Notification['Insert']) {
|
||||
return this.service.createNotification(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name createNotification
|
||||
* @description Create a new notification in the database
|
||||
* @param params
|
||||
*/
|
||||
dismissNotification(eqValue: string, eqColumn?: string) {
|
||||
return this.service.dismissNotification(eqColumn, eqValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,21 @@ class NotificationsService {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async dismissNotification(eqColumn = 'id', eqValue: string) {
|
||||
const logger = await getLogger();
|
||||
const { error } = await this.client
|
||||
.schema('medreport')
|
||||
.from('notifications')
|
||||
.update({ dismissed: true })
|
||||
.eq(eqColumn, eqValue);
|
||||
|
||||
if (error) {
|
||||
logger.error(
|
||||
{ eqColumn, eqValue },
|
||||
`Could not dismiss notification: ${error.message}`,
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user