wip: description, fix total_seconds

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt
2025-06-20 18:45:02 +02:00
parent b80abffafc
commit 8554a8e0c5
22 changed files with 99 additions and 66 deletions

View File

@ -2,6 +2,7 @@
from uuid import UUID
from django.utils.translation import gettext_lazy as _
from django.db.models.query_utils import Q
from django_dramatiq_postgres.middleware import CurrentTask
from dramatiq.actor import actor
@ -22,7 +23,7 @@ from authentik.tasks.models import Task
LOGGER = get_logger()
@actor
@actor(description=_("Check if policies attached to NotificationRule match event"))
def event_trigger_handler(event_uuid: UUID, trigger_name: str):
"""Check if policies attached to NotificationRule match event"""
event: Event = Event.objects.filter(event_uuid=event_uuid).first()
@ -79,7 +80,7 @@ def event_trigger_handler(event_uuid: UUID, trigger_name: str):
break
@actor
@actor(description=_("Send notification"))
def notification_transport(transport_pk: int, event_pk: str, user_pk: int, trigger_pk: str):
"""Send notification over specified transport"""
event = Event.objects.filter(pk=event_pk).first()
@ -100,7 +101,7 @@ def notification_transport(transport_pk: int, event_pk: str, user_pk: int, trigg
transport.send(notification)
@actor
@actor(description=_("Cleanup events for GDPR compliance"))
def gdpr_cleanup(user_pk: int):
"""cleanup events from gdpr_compliance"""
events = Event.objects.filter(user__pk=user_pk)