Files
work-volume-tracker/app/models/project.py
T
Александр Арсентьев d0b5745f8f feat: add agreements foundation
2026-09-25 18:41:08 +03:00

30 lines
1.1 KiB
Python

from sqlalchemy import Column, Integer, String, Date, DateTime, Text, Enum
from sqlalchemy.sql import func
from app.database.database import Base
from datetime import datetime
from typing import Optional
from sqlalchemy.orm import relationship
class Project(Base):
__tablename__ = "projects"
id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True, nullable=False)
contract_number = Column(String)
contract_date = Column(Date)
customer = Column(String)
currency = Column(String, default="RUB")
start_date = Column(Date)
end_date = Column(Date)
status = Column(String, default="active")
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
# Relationships
boq_documents = relationship("BoqDocument", back_populates="project")
systems = relationship("System", back_populates="project")
agreements = relationship("Agreement", back_populates="project", cascade="all, delete-orphan")
def __repr__(self):
return f"<Project(id={self.id}, name='{self.name}')>"