add: super admin role

This commit is contained in:
2025-07-15 22:51:16 +05:00
parent 9ab99aa7e4
commit eb7227bdc2
6 changed files with 35 additions and 10 deletions

View File

@ -9,7 +9,11 @@ def get_admin_by_username(db: Session, username: str) -> Optional[Admin]:
def create_admin(db: Session, admin: schemas.AdminCreate) -> Admin:
hashed_password = get_password_hash(admin.password)
db_admin = Admin(username=admin.username, hashed_password=hashed_password)
db_admin = Admin(
username=admin.username,
hashed_password=hashed_password,
is_super_admin=admin.is_super_admin
)
db.add(db_admin)
db.commit()
db.refresh(db_admin)