upd
This commit is contained in:
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user