1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 13:29:22 +00:00

Simplify method

This commit is contained in:
Pierre HUBERT 2020-03-30 15:06:30 +02:00
parent 3e9cd74f5e
commit d18914066b

View File

@ -317,15 +317,10 @@ export class NotificationsHelper {
*/ */
public static async Delete(n: Notif) { public static async Delete(n: Notif) {
// Delete a specific notification // Delete a specific notification
if(n.hasId) const cond = n.hasId ? {id: n.id} : this.NotifToDB(n, false);
await DatabaseHelper.DeleteRows(NOTIFICATIONS_TABLE, {
id: n.id
})
// Delete wider range of notifications
else
await DatabaseHelper.DeleteRows(NOTIFICATIONS_TABLE, this.NotifToDB(n, false))
// Delete notifications
await DatabaseHelper.DeleteRows(NOTIFICATIONS_TABLE, cond);
} }
/** /**