feat: common style for getters

This commit is contained in:
2025-08-29 23:51:38 +04:00
parent 5fbd6d6185
commit 93141da22c
8 changed files with 8 additions and 8 deletions

View File

@ -42,7 +42,7 @@ class UpdateBoardRequest(BaseSchema):
class GetBoardsResponse(BaseSchema): class GetBoardsResponse(BaseSchema):
boards: list[BoardSchema] items: list[BoardSchema]
class CreateBoardResponse(BaseResponse): class CreateBoardResponse(BaseResponse):

View File

@ -47,7 +47,7 @@ class UpdateDealRequest(BaseSchema):
class GetDealsResponse(BaseSchema): class GetDealsResponse(BaseSchema):
deals: list[DealSchema] items: list[DealSchema]
pagination_info: PaginationInfoSchema pagination_info: PaginationInfoSchema

View File

@ -38,7 +38,7 @@ class UpdateProjectRequest(BaseSchema):
class GetProjectsResponse(BaseSchema): class GetProjectsResponse(BaseSchema):
projects: list[ProjectSchema] items: list[ProjectSchema]
class CreateProjectResponse(BaseResponse): class CreateProjectResponse(BaseResponse):

View File

@ -42,7 +42,7 @@ class UpdateStatusRequest(BaseSchema):
class GetStatusesResponse(BaseSchema): class GetStatusesResponse(BaseSchema):
statuses: list[StatusSchema] items: list[StatusSchema]
class CreateStatusResponse(BaseResponse): class CreateStatusResponse(BaseResponse):

View File

@ -12,7 +12,7 @@ class BoardService:
async def get_boards(self, project_id: int) -> GetBoardsResponse: async def get_boards(self, project_id: int) -> GetBoardsResponse:
boards = await self.repository.get_all(project_id) boards = await self.repository.get_all(project_id)
return GetBoardsResponse( return GetBoardsResponse(
boards=[BoardSchema.model_validate(board) for board in boards] items=[BoardSchema.model_validate(board) for board in boards]
) )
async def create_board(self, request: CreateBoardRequest) -> CreateBoardResponse: async def create_board(self, request: CreateBoardRequest) -> CreateBoardResponse:

View File

@ -27,7 +27,7 @@ class DealService:
total_pages = math.ceil(total_items / pagination.items_per_page) total_pages = math.ceil(total_items / pagination.items_per_page)
return GetDealsResponse( return GetDealsResponse(
deals=[DealSchema.model_validate(deal) for deal in deals], items=[DealSchema.model_validate(deal) for deal in deals],
pagination_info=PaginationInfoSchema( pagination_info=PaginationInfoSchema(
total_pages=total_pages, total_items=total_items total_pages=total_pages, total_items=total_items
), ),

View File

@ -12,7 +12,7 @@ class ProjectService:
async def get_projects(self) -> GetProjectsResponse: async def get_projects(self) -> GetProjectsResponse:
projects = await self.repository.get_all() projects = await self.repository.get_all()
return GetProjectsResponse( return GetProjectsResponse(
projects=[ProjectSchema.model_validate(project) for project in projects] items=[ProjectSchema.model_validate(project) for project in projects]
) )
async def create_project( async def create_project(

View File

@ -13,7 +13,7 @@ class StatusService:
async def get_statuses(self, board_id: int) -> GetStatusesResponse: async def get_statuses(self, board_id: int) -> GetStatusesResponse:
statuses = await self.repository.get_all(board_id) statuses = await self.repository.get_all(board_id)
return GetStatusesResponse( return GetStatusesResponse(
statuses=[StatusSchema.model_validate(status) for status in statuses] items=[StatusSchema.model_validate(status) for status in statuses]
) )
async def create_status(self, request: CreateStatusRequest) -> CreateStatusResponse: async def create_status(self, request: CreateStatusRequest) -> CreateStatusResponse: