ci: add Dockerfile

This commit is contained in:
cătălin 2023-12-09 11:15:39 +01:00
commit 65a56f2658
Signed by: catalin
GPG key ID: 0178DF42F43E5FD2
15 changed files with 382 additions and 70 deletions

View file

@ -1,8 +0,0 @@
{
"version": "2.0",
"app_name": "secretsanta",
"stages": {
"dev": {
}
}
}

View file

@ -4,8 +4,8 @@ from chalice import Chalice
from secretsanta.domain import Group
from secretsanta.repo import S3Repo
from secretsanta.service import (
GetGroupParticipantsService,
CreateGroupService,
GetGroupParticipantsService,
GetPairService,
)
from secretsanta.settings import get_config
@ -16,13 +16,6 @@ app = Chalice(app_name="secretsanta", debug=config.environment == "local")
repo = S3Repo()
def _participants2url(participants: list[str], group_uuid: str) -> list[str]:
return [
f"{config.server_url}/api/v1/groups/{group_uuid}/pair/{participant_name}"
for participant_name in participants
]
@app.route("/api/v1/groups/{group_uuid}")
def get_participants(group_uuid: str):
service = GetGroupParticipantsService(repo)
@ -34,8 +27,7 @@ def create_group(group_uuid: str):
request = app.current_request
body = request.json_body
service = CreateGroupService(repo)
participants = anyio.run(service.run, Group(uuid=group_uuid, **body)).participants
return _participants2url(participants, group_uuid)
return anyio.run(service.run, Group(uuid=group_uuid, **body))
@app.route("/api/v1/groups/{group_uuid}/pair/{participant}")