Skip to content

Commit

Permalink
Добавляет поправки
Browse files Browse the repository at this point in the history
  • Loading branch information
codEnjoyer committed Dec 12, 2023
1 parent b295002 commit 4e01cec
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/game/map/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def get_map(id: UUID,

@router.post("/")
async def post_map(map_create: MapCreate,
map_service: MapServiceType) -> UUID:
map_service: MapServiceType) -> MapRead:
return await map_service.create_one(map_create)


Expand Down
2 changes: 1 addition & 1 deletion backend/src/game/modules/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def get_map_module(map_id: UUID,
async def post_module_to_map(map_id: UUID,
module_create: ModuleCreate,
module_service: ModuleServiceType) -> ModuleRead:
return await module_service.create_one(module_create)
return await module_service.create_one(map_id, module_create)


@router.delete("/maps/{map_id}/modules/{module_id}/")
Expand Down
9 changes: 5 additions & 4 deletions backend/src/game/modules/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class __ModuleBase(BaseModel):
map_id: UUID
title: str
previous_module_id: UUID | None
next_module_id: UUID | None
Expand All @@ -13,6 +12,7 @@ class __ModuleBase(BaseModel):


class ModuleRead(__ModuleBase):
map_id: UUID
id: UUID
levels_ids: list[UUID]

Expand All @@ -22,6 +22,7 @@ class ModuleCreate(__ModuleBase):


class ModuleUpdate(__ModuleBase):
title: str | None = None
previous_module_id: UUID | None = None
next_module_id: UUID | None = None
map_id: UUID | None
title: str | None
previous_module_id: UUID | None
next_module_id: UUID | None
2 changes: 1 addition & 1 deletion backend/src/game/units/tasks/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DiscussionTaskUnitUpdate(__TaskUnitUpdateBase):

# endregion Discussion
# region EmployeeTask
class __EmployeeTaskBase:
class __EmployeeTaskBase(BaseModel):
task_id: UUID
employee_id: UUID

Expand Down
3 changes: 2 additions & 1 deletion backend/src/services/game/module_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class ModuleService:
def __init__(self, repository: type[AbstractRepository]):
self.__module_repo = repository()

async def create_one(self, schema_create: ModuleCreate) -> ModuleRead:
async def create_one(self, map_id: uuid.UUID, schema_create: ModuleCreate) -> ModuleRead:
schema_dict = schema_create.model_dump()
schema_dict["map_id"] = map_id
return await self.__module_repo.add_one(schema_dict)

async def get_all(self) -> list[ModuleRead]:
Expand Down

0 comments on commit 4e01cec

Please sign in to comment.