This commit is contained in:
2024-03-19 09:01:46 +03:00
parent aafa1050a7
commit 6ba041a839
23 changed files with 369 additions and 39 deletions

21
models/service.py Normal file
View File

@@ -0,0 +1,21 @@
from sqlalchemy import Column, Integer, String, ForeignKey, Double
from sqlalchemy.orm import relationship
from models import BaseModel
class Service(BaseModel):
__tablename__ = 'services'
id = Column(Integer, autoincrement=True, primary_key=True, index=True)
name = Column(String, nullable=False, comment='Название услуги')
category_id = Column(Integer, ForeignKey('service_categories.id'), nullable=False, comment='ID категории услуги')
category = relationship('ServiceCategory')
price = Column(Double, nullable=False, comment='Стоимость услуги')
class ServiceCategory(BaseModel):
__tablename__ = 'service_categories'
id = Column(Integer, autoincrement=True, primary_key=True, index=True)
name = Column(String, nullable=False)