1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-09-19 05:38:48 +00:00

Can mark related notifications as seen

This commit is contained in:
2020-03-25 08:23:09 +01:00
parent 890e49a4ae
commit c67112d926
4 changed files with 77 additions and 3 deletions

View File

@@ -218,7 +218,7 @@ export class NotificationsHelper {
*
* @param n The notification
*/
private static async SimilarExists(n: Notif) : Promise<boolean> {
public static async SimilarExists(n: Notif) : Promise<boolean> {
return await DatabaseHelper.Count({
table: NOTIFICATIONS_TABLE,
where: this.NotifToDB(n, false)
@@ -286,6 +286,25 @@ export class NotificationsHelper {
return list.map((e) => this.DBToNotif(e));
}
/**
* Get information about a single notification
*
* @param notifID Target notification id
*/
public static async GetSingle(notifID: number) : Promise<Notif> {
const row = await DatabaseHelper.QueryRow({
table: NOTIFICATIONS_TABLE,
where: {
id: notifID
}
});
if(row == null)
throw new Error("Could not find notification !");
return this.DBToNotif(row);
}
/**
* Turn a notification into a database entry
*