Skip to content

Commit

Permalink
Merge pull request #12 from GSI-Xapiens-CSIRO/fix/return-quota-data
Browse files Browse the repository at this point in the history
Fix return if data does not exists
  • Loading branch information
titus-zx authored Dec 19, 2024
2 parents 1b956b9 + 1361df1 commit f2653cb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lambda/dataPortal/quota_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,13 @@ def store_quota(event, context):
@router.attach("/dportal/quota/{userIdentity}", "get")
def get_quota(event, context):
uId = event["pathParameters"]["userIdentity"]

try:
myQuota = Quota.get(uId)

except Quota.DoesNotExist:
raise PortalError(
error_code=409,
error_message="No data available here.",
)
return {'success': False, 'data': None}

return myQuota.to_dict()
return {'success': True, 'data': myQuota.to_dict()}

@router.attach("/dportal/quota/{userIdentity}/increment_usagecount", "post")
def increment_usagecount(event, context):
Expand Down

0 comments on commit f2653cb

Please sign in to comment.