mirror of
https://github.com/simple-login/app.git
synced 2024-11-15 13:14:36 +08:00
bdb0c8bd08
* feat: alias audit log * feat: crontab to delete old alias_audit_log entries * Unified messages --------- Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
12 lines
389 B
Python
12 lines
389 B
Python
import arrow
|
|
|
|
from app.db import Session
|
|
from app.log import LOG
|
|
from app.models import AliasAuditLog
|
|
|
|
|
|
def cleanup_alias_audit_log(oldest_allowed: arrow.Arrow):
|
|
LOG.i(f"Deleting alias_audit_log older than {oldest_allowed}")
|
|
count = AliasAuditLog.filter(AliasAuditLog.created_at < oldest_allowed).delete()
|
|
Session.commit()
|
|
LOG.i(f"Deleted {count} alias_audit_log entries")
|