feat: cards, attributes and modules

This commit is contained in:
2025-02-19 14:46:31 +04:00
parent a509a3a586
commit 1af78ce08a
61 changed files with 3212 additions and 2795 deletions

View File

@@ -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()