Skip to content

Commit

Permalink
Update TOS end point
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Jul 21, 2022
1 parent 244365b commit c28b131
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/quetz_tos/quetz_tos/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def get_current_tos(db: Session = Depends(get_db)):
)


@router.get("/api/tos/sign", status_code=201, tags=['Terms of Service'])
def get_sign_current_tos(
@router.get("/api/tos/status", status_code=201, tags=['Terms of Service'])
def get_current_tos_status(
db: Session = Depends(get_db),
dao: dao.Dao = Depends(get_dao),
auth: authorization.Rules = Depends(get_rules),
Expand All @@ -72,7 +72,14 @@ def get_sign_current_tos(
.filter(TermsOfServiceSignatures.tos_id == current_tos.id)
.one_or_none()
)
return True if signature else False
if signature:
return {
"tos_id": str(uuid.UUID(bytes=signature.tos_id)),
"user_id": str(uuid.UUID(bytes=signature.user_id)),
"time_created": signature.time_created,
}
else:
return None
else:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
Expand Down

0 comments on commit c28b131

Please sign in to comment.