ci: add Dockerfile
This commit is contained in:
parent
72ee09b064
commit
65a56f2658
15 changed files with 382 additions and 70 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue