feat: removed price categories

This commit is contained in:
2025-02-12 15:27:48 +04:00
parent 5b9e75dddf
commit a509a3a586
7 changed files with 3 additions and 220 deletions

View File

@@ -9,7 +9,6 @@ services_kit_services = Table(
BaseModel.metadata,
Column('services_kit_id', ForeignKey('services_kits.id')),
Column('service_id', ForeignKey('services.id')),
)
@@ -47,10 +46,6 @@ class Service(BaseModel):
lazy='selectin',
order_by="asc(ServicePriceRange.from_quantity)",
cascade="all, delete-orphan")
category_prices = relationship('ServiceCategoryPrice',
back_populates='service',
lazy='selectin',
cascade="all, delete-orphan")
rank: Mapped[str] = mapped_column(
nullable=False,
server_default='',
@@ -68,23 +63,6 @@ class ServicePriceRange(BaseModel):
price = Column(Double, nullable=False, comment='Цена')
class ServiceCategoryPrice(BaseModel):
__tablename__ = 'service_category_prices'
service_id: Mapped[int] = mapped_column(ForeignKey('services.id'), primary_key=True)
category_id: Mapped[int] = mapped_column(ForeignKey('service_price_category.id'), primary_key=True)
price: Mapped[float] = mapped_column(Double, nullable=False, comment='Цена')
service: Mapped["Service"] = relationship('Service', lazy='joined', back_populates='category_prices')
category: Mapped["ServicePriceCategory"] = relationship('ServicePriceCategory', lazy='joined')
class ServicePriceCategory(BaseModel):
__tablename__ = 'service_price_category'
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(nullable=False)
class ServiceCategory(BaseModel):
__tablename__ = 'service_categories'
id = Column(Integer, autoincrement=True, primary_key=True, index=True)