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,15 +1,15 @@
from dataclasses import dataclass, asdict
from typing import Literal, Annotated
from dataclasses import asdict, dataclass
from typing import Annotated, Literal
from litestar import Controller, get, Litestar, put, Request, Response, MediaType
from litestar import Controller, Litestar, MediaType, Request, Response, get, put
from litestar.params import Parameter
from pydantic import UUID4
from secretsanta.domain import Group
from secretsanta.repo import S3Repo
from secretsanta.service import (
GetGroupParticipantsService,
CreateGroupService,
GetGroupParticipantsService,
GetPairService,
)
from secretsanta.settings import get_config
@ -46,10 +46,13 @@ class GroupController(Controller):
@put("/{group_uuid:uuid}")
async def create_group(
self, request: Request, group_uuid: UUID4, data: CreateGroup
self,
request: Request,
group_uuid: UUID4,
data: CreateGroup,
) -> list[str]:
group = await self.create_group_service.run(
Group(uuid=group_uuid, **asdict(data))
Group(uuid=group_uuid, **asdict(data)),
)
return self._group2urls(group.participants, request.url)
@ -59,11 +62,13 @@ class GroupController(Controller):
group_uuid: UUID4,
participant_name: str,
response_type: Annotated[
Literal["json", "plain"], Parameter(query="type")
Literal["json", "plain"],
Parameter(query="type"),
] = "plain",
) -> Response[str] | PairResponse:
pair = await self.get_pair_service.run(
group_uuid=group_uuid, participant=participant_name
group_uuid=group_uuid,
participant=participant_name,
)
if response_type == "json":
return PairResponse(pair=pair)