This commit is contained in:
2024-06-12 15:54:56 +03:00
parent 3fb38cac3a
commit 2951a559bc
13 changed files with 245 additions and 61 deletions

View File

@ -147,6 +147,27 @@ def get_anon_user(
return create_anon_user(db)
def patch_anon_name(
data: schemas.AnonUserPatch,
db: Annotated[Session, Depends(get_db)],
x_client_id: Annotated[Union[str, None], Header()] = None,
) -> schemas.AnonUser:
if x_client_id:
anon = (
db.query(models.AnonymousUser)
.filter(models.AnonymousUser.id == x_client_id)
.first()
)
if anon:
setattr(anon, "name", data.name)
db.commit()
return anon
raise HTTPException(
status_code=status.HTTP_418_IM_A_TEAPOT,
)
return create_anon_user(db)
def get_captcha(
captcha_id: uuid.UUID, db: Annotated[Session, Depends(get_db)]
) -> BytesIO: