mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 09:50:38 +01:00
0da1811311
* Cleanup tasks * Update * Added tests * Create cron job * Delete old data cron * Fix import * import fix * Added delete + script to disable pgp for proton mboxes
12 lines
376 B
Python
12 lines
376 B
Python
import arrow
|
|
|
|
from app.db import Session
|
|
from app.log import LOG
|
|
from app.models import Notification
|
|
|
|
|
|
def cleanup_old_notifications(oldest_allowed: arrow.Arrow):
|
|
LOG.i(f"Deleting notifications older than {oldest_allowed}")
|
|
count = Notification.filter(Notification.created_at < oldest_allowed).delete()
|
|
Session.commit()
|
|
LOG.i(f"Deleted {count} notifications")
|