added functional groups api + started pictures

This commit is contained in:
2025-07-30 19:10:10 +03:00
parent c203a890dc
commit 3341d68c7e
20 changed files with 1103 additions and 120 deletions

View File

@ -22,6 +22,11 @@ async def add_admin(
status_code=status.HTTP_403_FORBIDDEN,
detail="Not allowed",
)
if db.check_user_existence(conn, username):
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail="User already exists",
)
hashed_password = get_password_hash(password)
return db.create_user(conn, username, hashed_password, "admin")
@ -36,5 +41,10 @@ async def add_user(
status_code=status.HTTP_403_FORBIDDEN,
detail="Not allowed",
)
if db.check_user_existence(conn, username):
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail="User already exists",
)
hashed_password = get_password_hash(password)
return db.create_user(conn, username, hashed_password, "user")