see all notifs

This commit is contained in:
2025-12-21 15:13:11 +03:30
parent a605e2a5e6
commit 2f409e5c8c
2 changed files with 35 additions and 0 deletions
@@ -244,4 +244,22 @@ export class NotificationService {
};
return this.em.count(Notification, where);
}
readAllNotifsAsUser(userId: string, restaurantId: string): Promise<number> {
const where: FilterQuery<Notification> = {
user: { id: userId },
restaurant: { id: restaurantId },
seenAt: null,
};
return this.em.nativeUpdate(Notification, where, { seenAt: new Date() });
}
readAllNotifsAsAdmin(adminId: string, restaurantId: string): Promise<number> {
const where: FilterQuery<Notification> = {
admin: { id: adminId },
restaurant: { id: restaurantId },
seenAt: null,
};
return this.em.nativeUpdate(Notification, where, { seenAt: new Date() });
}
}