sprint6+7: permission notifications + audit trail + notification entity filter + mail account permissions + migration 0053
Check Cross-Plugin Imports / check (push) Has been cancelled

This commit is contained in:
Agent Zero
2026-07-29 02:18:17 +02:00
parent 71ed592aa2
commit 88c04286af
7 changed files with 240 additions and 64 deletions
+8
View File
@@ -23,6 +23,8 @@ async def create_notification(
type: str,
title: str,
body: str | None = None,
entity_type: str | None = None,
entity_id: uuid.UUID | None = None,
) -> Notification | None:
"""Create a new notification for a user if they have not disabled this type.
@@ -60,6 +62,8 @@ async def create_notification(
type=type,
title=title,
body=body,
entity_type=entity_type,
entity_id=entity_id,
)
db.add(notif)
await db.flush()
@@ -73,6 +77,8 @@ async def create_notification(
'user_id': str(user_id),
'type': type,
'title': title,
'entity_type': entity_type,
'entity_id': str(entity_id) if entity_id else None,
})
return notif
@@ -173,6 +179,8 @@ def _notification_to_dict(n: Notification) -> dict[str, Any]:
"type": n.type,
"title": n.title,
"body": n.body,
"entity_type": n.entity_type,
"entity_id": str(n.entity_id) if n.entity_id else None,
"read_at": n.read_at.isoformat() if n.read_at else None,
"created_at": n.created_at.isoformat() if n.created_at else None,
}