feat: added tags for cards, aligned status headers

This commit is contained in:
2025-03-09 19:30:52 +04:00
parent 487174c4ff
commit 6030591e3c
17 changed files with 375 additions and 23 deletions

View File

@@ -10,8 +10,10 @@ from .shipping import Pallet, Box
from .shipping_warehouse import ShippingWarehouse
if TYPE_CHECKING:
from . import CardBillRequest, User, BaseModel, Board, CardStatus, CardGroup, CardAttribute, CardService as CardServiceModel, \
CardProduct, Client
from . import (
CardBillRequest, User, BaseModel, Board, CardStatus, CardGroup, CardAttribute, Client, CardTag,
CardService as CardServiceModel, CardProduct,
)
class Card(BaseModel):
@@ -56,6 +58,13 @@ class Card(BaseModel):
lazy='joined',
back_populates='cards'
)
tags: Mapped[list['CardTag']] = relationship(
'CardTag',
secondary='cards_card_tags',
back_populates='cards',
lazy='selectin',
)
# endregion
# region Attributes handled by modules
@@ -107,6 +116,7 @@ class Card(BaseModel):
# endregion
class CardEmployees(BaseModel):
__tablename__ = 'card_employees'
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), primary_key=True)
@@ -116,4 +126,3 @@ class CardEmployees(BaseModel):
card: Mapped[Card] = relationship('Card', back_populates='employees', lazy='selectin')
created_at: Mapped[datetime] = mapped_column()