28 lines
1.0 KiB
Python
28 lines
1.0 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")
|
|
|
|
def __repr__(self):
|
|
return f"<Project(id={self.id}, name='{self.name}')>" |