WIP: Add conditional questions - backend models and schemas updated
This commit is contained in:
@@ -71,11 +71,18 @@ class Question(Base):
|
||||
allow_photos = Column(Boolean, default=True)
|
||||
max_photos = Column(Integer, default=3)
|
||||
requires_comment_on_fail = Column(Boolean, default=False)
|
||||
|
||||
# Conditional logic
|
||||
parent_question_id = Column(Integer, ForeignKey("questions.id"), nullable=True)
|
||||
show_if_answer = Column(String(50), nullable=True) # Valor que dispara esta pregunta
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
# Relationships
|
||||
checklist = relationship("Checklist", back_populates="questions")
|
||||
answers = relationship("Answer", back_populates="question")
|
||||
subquestions = relationship("Question", backref="parent", remote_side=[id])
|
||||
|
||||
|
||||
|
||||
class Inspection(Base):
|
||||
|
||||
Reference in New Issue
Block a user