diff --git a/src/user/router.py b/src/user/router.py index 6c87e24..adcfb57 100644 --- a/src/user/router.py +++ b/src/user/router.py @@ -7,6 +7,7 @@ Endpoints: - [GET](/user/): [super admin]: Returns user(id) details. - [DELETE](/user/): [super admin]: Removes a User(id) from the hub database. """ +from datetime import datetime, timezone from fastapi import APIRouter, status, BackgroundTasks @@ -104,7 +105,7 @@ async def get_user_by_id( status.HTTP_404_NOT_FOUND: {"description": "User not found"}, }, ) -async def delete_user_by_id( +async def soft_delete_user_by_id( db: DbSession, user_model: user_model_query_dependency, su: super_admin_dependency, @@ -112,7 +113,8 @@ async def delete_user_by_id( """ Deletes the user with the provided ID from the database. This will not remove them from OIDC, and they will be automatically readded on next login. """ - db.delete(user_model) + user_model.active = False + user_model.deleted_at = datetime.now(tz=timezone.utc) db.commit()