21 lines
727 B
Python
21 lines
727 B
Python
from models import Board
|
|
from repositories import BoardRepository
|
|
from schemas.board import *
|
|
from services.mixins import *
|
|
|
|
|
|
class BoardService(
|
|
ServiceCrudMixin[Board, BoardSchema, CreateBoardSchema, UpdateBoardSchema]
|
|
):
|
|
schema_class = BoardSchema
|
|
entity_not_found_msg = "Доска не найдена"
|
|
entity_deleted_msg = "Доска успешно удалена"
|
|
entity_updated_msg = "Доска успешно обновлена"
|
|
entity_created_msg = "Доска успешно создана"
|
|
|
|
def __init__(self, session: AsyncSession):
|
|
self.repository = BoardRepository(session)
|
|
|
|
async def is_soft_delete(self, board: BoardSchema) -> bool:
|
|
return len(board.deals) > 0
|