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:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user