Nuevos cambios en el backend
This commit is contained in:
@@ -39,6 +39,12 @@ class ExamTemplate(Base):
|
||||
__tablename__ = "exam_templates"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("users.id", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
title: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
subject: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
educational_level: Mapped[str] = mapped_column(String(120), nullable=False)
|
||||
@@ -48,6 +54,8 @@ class ExamTemplate(Base):
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
|
||||
owner: Mapped["User"] = relationship(back_populates="exam_templates")
|
||||
|
||||
questions: Mapped[list["Question"]] = relationship(
|
||||
back_populates="template",
|
||||
cascade="all, delete-orphan",
|
||||
|
||||
Reference in New Issue
Block a user