load project
This commit is contained in:
23
backend/app/models/document.py
Normal file
23
backend/app/models/document.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, ForeignKey, String, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class FilledDocument(Base):
|
||||
__tablename__ = "filled_documents"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
||||
template_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("document_templates.id", ondelete="CASCADE")
|
||||
)
|
||||
owner_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"))
|
||||
name: Mapped[str] = mapped_column(String(255))
|
||||
field_data: Mapped[str] = mapped_column(Text)
|
||||
rendered_docx_path: Mapped[str | None] = mapped_column(String(512), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
|
||||
template = relationship("DocumentTemplate", back_populates="documents")
|
||||
owner = relationship("User", back_populates="documents")
|
||||
Reference in New Issue
Block a user