Transaction.

This commit is contained in:
retoor 2025-03-27 20:10:05 +01:00
parent 71a206a19f
commit bd5bb5ae65

View File

@ -30,6 +30,7 @@ class NotificationService(BaseService):
uid=channel_message_uid
)
user = await self.services.user.get(uid=channel_message["user_uid"])
self.app.db.begin()
async for channel_member in self.services.channel_member.find(
channel_uid=channel_message["channel_uid"],
is_banned=False,
@ -56,3 +57,5 @@ class NotificationService(BaseService):
await self.save(model)
except Exception as ex:
raise Exception(f"Failed to create notification: {model.errors}.")
self.app.db.commit()