feat: add user from admin panel

This commit is contained in:
Timothy J. Baek 2024-05-01 18:06:02 -07:00
parent 96af34f240
commit e6bcdba5ad
5 changed files with 36 additions and 8 deletions

View file

@ -90,7 +90,7 @@ class SignupForm(BaseModel):
class AddUserForm(SignupForm):
role: str = "pending"
role: Optional[str] = "pending"
class AuthsTable:

View file

@ -223,14 +223,15 @@ async def signup(form_data: AddUserForm, user=Depends(get_admin_user)):
raise HTTPException(400, detail=ERROR_MESSAGES.EMAIL_TAKEN)
try:
role = form_data.role
print(form_data)
hashed = get_password_hash(form_data.password)
user = Auths.insert_new_auth(
form_data.email.lower(),
hashed,
form_data.name,
form_data.profile_image_url,
role,
form_data.role,
)
if user: