Notifications accept.
This commit is contained in:
		
							parent
							
								
									578c182f27
								
							
						
					
					
						commit
						580ec5ab0d
					
				| @ -6,8 +6,11 @@ class NotificationService(BaseService): | |||||||
| 
 | 
 | ||||||
|     async def mark_as_read(self, user_uid, channel_message_uid): |     async def mark_as_read(self, user_uid, channel_message_uid): | ||||||
|         model = await self.get(user_uid, object_uid=channel_message_uid) |         model = await self.get(user_uid, object_uid=channel_message_uid) | ||||||
|  |         if not model: | ||||||
|  |             return False  | ||||||
|         model['read_at'] = now() |         model['read_at'] = now() | ||||||
|         await self.save(model) |         await self.save(model) | ||||||
|  |         return True  | ||||||
|      |      | ||||||
|     async def get_unread_stats(self,user_uid): |     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)) |         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)) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user