@@ -55,8 +55,9 @@ async def create_notification_group(
5555 intent = NotificationIntent (
5656 scope = body .scope ,
5757 event_type = body .event_type ,
58- meta = body .meta ,
58+ message = body .message ,
5959 actor_id = body .actor_id ,
60+ subject_id = body .subject_id ,
6061 organization_id = body .organization_id ,
6162 project_id = body .project_id ,
6263 recipient_ids = body .recipient_ids ,
@@ -209,23 +210,28 @@ async def delete_notification(
209210
210211@router .patch (
211212 "/v2/notifications/opened" ,
212- summary = "Mark a notification as opened." ,
213+ summary = "Mark one or more notifications as opened." ,
213214 description = "Permissions: notification owner." ,
214215)
215216@handle_exception
216217async def set_opened (
217218 user : Annotated [UserAuth , Depends (auth_user_service_key )],
218219 session : Annotated [AsyncSession , Depends (yield_async_session )],
219- notification_group_id : Annotated [
220- str , Query (min_length = 1 , description = "Notification group ID ." )
220+ notification_group_ids : Annotated [
221+ list [ str ] , Query (min_length = 1 , description = "List of notification group IDs ." )
221222 ],
222223) -> OkResponse :
223- notif = await session .get (Notification , (user .id , notification_group_id ))
224- if notif is None or notif .deleted_at is not None :
225- raise ResourceNotFoundError ("Notification not found." )
226224 timestamp = now ()
227- notif .opened_at = timestamp
228- notif .updated_at = timestamp
225+ await session .exec (
226+ update (Notification )
227+ .where (
228+ Notification .user_id == user .id ,
229+ Notification .notification_group_id .in_ (notification_group_ids ),
230+ Notification .opened_at .is_ (None ),
231+ Notification .deleted_at .is_ (None ),
232+ )
233+ .values (opened_at = timestamp , updated_at = timestamp )
234+ )
229235 await session .commit ()
230236 return OkResponse ()
231237
0 commit comments