feat: cards, attributes and modules
This commit is contained in:
@@ -3,7 +3,7 @@ from typing import Optional
|
||||
|
||||
from sqlalchemy import select, and_, func
|
||||
|
||||
from models import Board, Deal
|
||||
from models import Board, Card
|
||||
from schemas.board import *
|
||||
from services.base import BaseService
|
||||
|
||||
@@ -76,12 +76,12 @@ class BoardService(BaseService):
|
||||
|
||||
async def _count_deals_in_progress(self, board_id: int) -> int:
|
||||
stmt = (
|
||||
select(func.count(Deal.id))
|
||||
select(func.count(Card.id))
|
||||
.where(
|
||||
and_(
|
||||
Deal.board_id == board_id,
|
||||
Deal.is_deleted == False,
|
||||
Deal.is_completed == False,
|
||||
Card.board_id == board_id,
|
||||
Card.is_deleted == False,
|
||||
Card.is_completed == False,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -89,8 +89,8 @@ class BoardService(BaseService):
|
||||
|
||||
async def _count_deals(self, board_id: int) -> int:
|
||||
stmt = (
|
||||
select(func.count(Deal.id))
|
||||
.where(Deal.board_id == board_id)
|
||||
select(func.count(Card.id))
|
||||
.where(Card.board_id == board_id)
|
||||
)
|
||||
return (await self.session.scalars(stmt)).first()
|
||||
|
||||
@@ -111,7 +111,7 @@ class BoardService(BaseService):
|
||||
await self.session.delete(board)
|
||||
else:
|
||||
board.is_deleted = True
|
||||
for status in board.deal_statuses:
|
||||
for status in board.statuses:
|
||||
status.is_deleted = True
|
||||
|
||||
await self.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user