MED-198: add notification for new analysis result

This commit is contained in:
Danel Kungla
2025-10-08 16:32:19 +03:00
parent 3a8d73e742
commit 8386e541cb
16 changed files with 126 additions and 16 deletions

View File

@@ -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);
}
}

View File

@@ -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;
}
}
}