feat(api): fixed edit appearance

This commit is contained in:
Taha Yassine Kraiem 2022-02-07 17:52:54 +01:00
parent 6d4d6b433c
commit bd95e01552
4 changed files with 21 additions and 0 deletions

View file

@ -315,6 +315,11 @@ def edit(user_id_to_update, tenant_id, changes, editor_id):
return {"data": user}
def edit_appearance(user_id, tenant_id, changes):
updated_user = update(tenant_id=tenant_id, user_id=user_id, changes=changes)
return {"data": updated_user}
def get_by_email_only(email):
with pg_client.PostgresClient() as cur:
cur.execute(

View file

@ -1069,6 +1069,13 @@ def edit_account(data: schemas.EditUserSchema = Body(...),
editor_id=context.user_id)
@app.post('/account/appearance', tags=["account"])
@app.put('/account/appearance', tags=["account"])
def edit_account_appearance(data: schemas.EditUserAppearanceSchema = Body(...),
context: schemas.CurrentContext = Depends(OR_context)):
return users.edit_appearance(tenant_id=context.tenant_id, user_id=context.user_id, changes=data.dict())
@app.post('/account/password', tags=["account"])
@app.put('/account/password', tags=["account"])
def change_client_password(data: schemas.EditUserPasswordSchema = Body(...),

View file

@ -36,6 +36,10 @@ class EditUserSchema(BaseModel):
appearance: Optional[dict] = Field({})
class EditUserAppearanceSchema(BaseModel):
appearance: dict = Field(...)
class ForgetPasswordPayloadSchema(_Grecaptcha):
email: str = Field(...)

View file

@ -340,6 +340,11 @@ def edit(user_id_to_update, tenant_id, changes, editor_id):
return {"data": user}
def edit_appearance(user_id, tenant_id, changes):
updated_user = update(tenant_id=tenant_id, user_id=user_id, changes=changes)
return {"data": updated_user}
def get_by_email_only(email):
with pg_client.PostgresClient() as cur:
cur.execute(