-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benjamin Bayart
committed
Jul 9, 2024
1 parent
c3286be
commit fd9b3ea
Showing
6 changed files
with
164 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import fastapi | ||
|
||
from ... import auth, sql_api | ||
from .. import dependencies, routers | ||
|
||
|
||
@routers.users.delete("/{user_name}", status_code=fastapi.status.HTTP_204_NO_CONTENT) | ||
async def delete_user( | ||
db: dependencies.DependsApiDb, | ||
user: auth.DependsBasicAdmin, | ||
user_name: str, | ||
) -> None: | ||
user_db = sql_api.get_user(db, user_name) | ||
if user_db is None: | ||
raise fastapi.HTTPException(status_code=404, detail="Not found") | ||
|
||
sql_api.delete_allows_by_user(db, user_name) | ||
sql_api.delete_user(db, user_name) | ||
return None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters