add: super admin role
This commit is contained in:
6
crud.py
6
crud.py
@ -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)
|
||||
|
Reference in New Issue
Block a user