Add account deletion scheduler and comprehensive tests
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 49s
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 49s
- Implemented account deletion scheduler in `account_deletion_scheduler.py` to manage user deletions based on a defined threshold. - Added logging for deletion processes, including success and error messages. - Created tests for deletion logic, including edge cases, retry logic, and integration tests to ensure complete deletion workflows. - Ensured that deletion attempts are tracked and that users are marked for manual intervention after exceeding maximum attempts. - Implemented functionality to check for interrupted deletions on application startup and retry them.
This commit is contained in:
@@ -15,3 +15,4 @@ class EventType(Enum):
|
||||
CHILD_MODIFIED = "child_modified"
|
||||
|
||||
USER_MARKED_FOR_DELETION = "user_marked_for_deletion"
|
||||
USER_DELETED = "user_deleted"
|
||||
|
||||
26
backend/events/types/user_deleted.py
Normal file
26
backend/events/types/user_deleted.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from events.types.payload import Payload
|
||||
|
||||
|
||||
class UserDeleted(Payload):
|
||||
"""
|
||||
Event payload for when a user account is deleted.
|
||||
This event is broadcast only to admin users.
|
||||
"""
|
||||
def __init__(self, user_id: str, email: str, deleted_at: str):
|
||||
super().__init__({
|
||||
'user_id': user_id,
|
||||
'email': email,
|
||||
'deleted_at': deleted_at,
|
||||
})
|
||||
|
||||
@property
|
||||
def user_id(self) -> str:
|
||||
return self.get("user_id")
|
||||
|
||||
@property
|
||||
def email(self) -> str:
|
||||
return self.get("email")
|
||||
|
||||
@property
|
||||
def deleted_at(self) -> str:
|
||||
return self.get("deleted_at")
|
||||
Reference in New Issue
Block a user