- Cần có attachment và comment riêng
- Cần có status (các status nào?)
- Cần có weight
- Có cần duedate riêng không?
- Có cần được approved bởi manager?
- Weight là trọng số nguyên hay %
class GoalKeyResult(Base):
__tablename__ = "goal_key_results"
id = Column(Integer, primary_key=True, index=True)
content = Column(String, nullable=False)
weight = Column(Integer, nullable=False)
status = Column(String, nullable=False, default="not_achieved")
type = Column(String, nullable=False, default="personal")
goal_id = Column(Integer, ForeignKey("goals.id", ondelete="CASCADE"))
due_date = Column(Date, nullable=True)
deleted_at = Column(DateTime, nullable=True)
created_at = Column(DateTime, default=datetime.utcnow)
created_by = Column(UUID(as_uuid=True), ForeignKey("users.id", ondelete="CASCADE"))
modified_at = Column(
DateTime,
default=datetime.utcnow,
onupdate=datetime.utcnow,
)
modified_by = Column(UUID, nullable=False)
goal = relationship("Goal", foreign_keys=[goal_id])
attachments: Mapped[List[AttachmentModel]] = relationship(
"Attachment", back_populates="goal"
)
class GoalKeyResultComment(Base):
__tablename__ = "goal_key_result_comments"
id = Column(Integer, primary_key=True, index=True)
content = Column(String, nullable=False)
goal_key_result_id = Column(Integer, ForeignKey("goal_key_results.id", ondelete="CASCADE"))
deleted_at = Column(DateTime, nullable=True)
created_at = Column(DateTime, default=datetime.utcnow)
created_by = Column(UUID(as_uuid=True), ForeignKey("users.id", ondelete="CASCADE"))
modified_at = Column(
DateTime,
default=datetime.utcnow,
onupdate=datetime.utcnow,
)
modified_by = Column(UUID, nullable=False)
goal_key_result = relationship("GoalKeyResult", foreign_keys=[goal_key_result_id])
attachments = relationship("Attachment", back_populates="goal_key_result_comment")