Notifications accept.

This commit is contained in:
retoor 2025-03-05 17:52:18 +01:00
parent 578c182f27
commit 580ec5ab0d

View File

@ -6,9 +6,12 @@ class NotificationService(BaseService):
async def mark_as_read(self, user_uid, channel_message_uid):
model = await self.get(user_uid, object_uid=channel_message_uid)
if not model:
return False
model['read_at'] = now()
await self.save(model)
return True
async def get_unread_stats(self,user_uid):
records = await self.query("SELECT object_type, COUNT(*) as count FROM notification WHERE user_uid=:user_uid AND read_at IS NULL GROUP BY object_type",dict(user_uid=user_uid))