Skip to content

Commit

Permalink
feat: move infra for v2 to the v2 folder, removing unused lambda hand…
Browse files Browse the repository at this point in the history
…lers, fixing routing (#712)
  • Loading branch information
nutrina authored Oct 25, 2024
1 parent f3f4cc9 commit 6a9a07d
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 562 deletions.
35 changes: 0 additions & 35 deletions api/aws_lambdas/submit_passport/submit_passport.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,3 @@ def _handler(event, _context, request, user_account, body):
def handler(*args, **kwargs):
close_old_connections()
return _handler(*args, **kwargs)


@with_api_request_exception_handling
def _handler_get_score(event, _context, request, user_account, body):
path = event.get("path", "").split("/")

if len(path) != 6:
raise InvalidRequest(f"Invalid path: '{path}'")

scorer_id = path[3]
address = path[5]

logger.info(f"path: '%s', scorer_id: '%s', address: %s", path, scorer_id, address)

# unquote(event.get("queryStringParameters", {}).get("model_list", ""))

score = async_to_sync(ahandle_submit_passport)(
SubmitPassportPayload(
scorer_id=scorer_id,
address=address,
),
user_account,
)

return score


def handler_get_score(*args, **kwargs):
"""
This handles the new GET request for the score, that also implies doing the same score
calculation as on the previous POST `submit-passport` request
"""

close_old_connections()
return _handler_get_score(*args, **kwargs)
Loading

0 comments on commit 6a9a07d

Please sign in to comment.