feat: board creation endpoint
This commit is contained in:
@ -7,6 +7,8 @@ from schemas.board import (
|
||||
BoardSchema,
|
||||
UpdateBoardRequest,
|
||||
UpdateBoardResponse,
|
||||
CreateBoardRequest,
|
||||
CreateBoardResponse,
|
||||
)
|
||||
|
||||
|
||||
@ -20,7 +22,16 @@ class BoardService:
|
||||
boards=[BoardSchema.model_validate(board) for board in boards]
|
||||
)
|
||||
|
||||
async def update_board(self, board_id: int, request: UpdateBoardRequest):
|
||||
async def create_board(self, request: CreateBoardRequest) -> CreateBoardResponse:
|
||||
board = await self.repository.create(request.board)
|
||||
return CreateBoardResponse(
|
||||
board=BoardSchema.model_validate(board),
|
||||
message="Доска успешно создана",
|
||||
)
|
||||
|
||||
async def update_board(
|
||||
self, board_id: int, request: UpdateBoardRequest
|
||||
) -> UpdateBoardResponse:
|
||||
board = await self.repository.get_by_id(board_id)
|
||||
if not board:
|
||||
raise HTTPException(status_code=404, detail="Доска не найдена")
|
||||
|
||||
Reference in New Issue
Block a user