From 5eea10398db989318ff5b69372b478701040c4f4 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 24 Mar 2020 08:10:50 +0100 Subject: [PATCH] First private notification --- src/helpers/NotificationsHelper.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/helpers/NotificationsHelper.ts b/src/helpers/NotificationsHelper.ts index 5d96dd1..420ea97 100644 --- a/src/helpers/NotificationsHelper.ts +++ b/src/helpers/NotificationsHelper.ts @@ -79,9 +79,7 @@ export class NotificationsHelper { if(await this.SimilarExists(n)) return; - - throw new Error("Create the notification!") - //await this.Create(n) + await this.Create(n) } /** @@ -97,6 +95,18 @@ export class NotificationsHelper { }) > 0; } + /** + * Create the notification + * + * @param n The notification + */ + private static async Create(n: Notif) { + await DatabaseHelper.InsertRow( + NOTIFICATIONS_TABLE, + this.NotifToDB(n, true) + ) + } + /** * Count the number of unread notifications of a user *