feat: add KS-3/payments, tech debt fixes, UI polish, and KS-2 Excel/Word export
Tasks 008-016: KS-6a journal, KS-3 documents, payments with allocations, tech debt cleanup, financial privacy, document tree, storno mechanism, row-click UI, BOQ collapse/sticky header, and KS-2 export to Excel/Word via shared DTO architecture.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from sqlalchemy import Column, Date, DateTime, ForeignKey, Integer, Numeric, String, Text, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from app.database.database import Base
|
||||
|
||||
|
||||
class KS3(Base):
|
||||
__tablename__ = "ks3_documents"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
project_id = Column(Integer, ForeignKey("projects.id"), nullable=False, index=True)
|
||||
number = Column(String, nullable=False)
|
||||
date = Column(Date, nullable=False, index=True)
|
||||
reporting_period_from = Column(Date, nullable=True)
|
||||
reporting_period_to = Column(Date, nullable=True)
|
||||
comment = Column(Text)
|
||||
status = Column(String, nullable=False, default="draft", index=True)
|
||||
created_at = Column(DateTime, nullable=False, server_default=func.now())
|
||||
updated_at = Column(DateTime, nullable=False, server_default=func.now(), onupdate=func.now())
|
||||
|
||||
project = relationship("Project")
|
||||
links = relationship("KS3KS2", back_populates="ks3", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class KS3KS2(Base):
|
||||
__tablename__ = "ks3_ks2_links"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("ks3_id", "ks2_id", name="uq_ks3_ks2_link"),
|
||||
)
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
ks3_id = Column(Integer, ForeignKey("ks3_documents.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
ks2_id = Column(Integer, ForeignKey("ks2_documents.id"), nullable=False, index=True)
|
||||
|
||||
ks3 = relationship("KS3", back_populates="links")
|
||||
ks2 = relationship("KS2")
|
||||
Reference in New Issue
Block a user