Build 2602261605: invite trace and cross-system user lifecycle
This commit is contained in:
@@ -732,6 +732,42 @@ def set_user_blocked(username: str, blocked: bool) -> None:
|
||||
)
|
||||
|
||||
|
||||
def delete_user_by_username(username: str) -> bool:
|
||||
with _connect() as conn:
|
||||
cursor = conn.execute(
|
||||
"""
|
||||
DELETE FROM users WHERE username = ? COLLATE NOCASE
|
||||
""",
|
||||
(username,),
|
||||
)
|
||||
return cursor.rowcount > 0
|
||||
|
||||
|
||||
def delete_user_activity_by_username(username: str) -> int:
|
||||
with _connect() as conn:
|
||||
cursor = conn.execute(
|
||||
"""
|
||||
DELETE FROM user_activity WHERE username = ? COLLATE NOCASE
|
||||
""",
|
||||
(username,),
|
||||
)
|
||||
return cursor.rowcount
|
||||
|
||||
|
||||
def disable_signup_invites_by_creator(username: str) -> int:
|
||||
timestamp = datetime.now(timezone.utc).isoformat()
|
||||
with _connect() as conn:
|
||||
cursor = conn.execute(
|
||||
"""
|
||||
UPDATE signup_invites
|
||||
SET enabled = 0, updated_at = ?
|
||||
WHERE created_by = ? COLLATE NOCASE AND enabled != 0
|
||||
""",
|
||||
(timestamp, username),
|
||||
)
|
||||
return cursor.rowcount
|
||||
|
||||
|
||||
def set_user_role(username: str, role: str) -> None:
|
||||
with _connect() as conn:
|
||||
conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user