29 lines
920 B
Python
29 lines
920 B
Python
from typing import TYPE_CHECKING
|
|
|
|
from sqlalchemy import ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from models.base import BaseModel
|
|
from models.mixins import PriceMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from models import Deal
|
|
from modules.fulfillment_base.models import Service
|
|
|
|
|
|
class DealService(BaseModel, PriceMixin):
|
|
__tablename__ = "fulfillment_base_deal_services"
|
|
|
|
deal_id: Mapped[int] = mapped_column(ForeignKey("deals.id"), primary_key=True)
|
|
deal: Mapped["Deal"] = relationship(backref="deal_services")
|
|
|
|
service_id: Mapped[int] = mapped_column(
|
|
ForeignKey("fulfillment_base_services.id"), primary_key=True
|
|
)
|
|
service: Mapped["Service"] = relationship()
|
|
|
|
quantity: Mapped[int] = mapped_column(default=1)
|
|
is_fixed_price: Mapped[bool] = mapped_column(
|
|
default=False, server_default="0", comment="Фиксированная цена"
|
|
)
|