Align engagement task model and repair missing task generation

This commit is contained in:
A R R R Associates
2026-08-07 15:33:49 +05:30
parent 5ec7f7d446
commit a512aec512
2 changed files with 21 additions and 1 deletions
+16 -1
View File
@@ -2,7 +2,7 @@ from __future__ import annotations
from datetime import date, datetime, timezone
from sqlalchemy import Boolean, Date, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint
from sqlalchemy import Boolean, Date, DateTime, ForeignKey, Integer, Numeric, String, Text, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.core.db.common import CommonBase
@@ -743,6 +743,21 @@ class ClientServiceTaskInstance(CommonBase):
status: Mapped[str] = mapped_column(String(30), nullable=False, default="pending", index=True)
priority: Mapped[str] = mapped_column(String(20), nullable=False, default="normal")
# Structured checklist snapshot fields. These columns already exist in the
# production database via Alembic revision 20260719_task_checklist_fields.
# Keeping them on the ORM model is required so task generation and the
# existing Work Tracker checklist UI use the same persisted schema.
task_category: Mapped[str | None] = mapped_column(String(100), nullable=True, index=True)
response_required: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
response_type: Mapped[str] = mapped_column(String(20), nullable=False, default="NONE")
evidence_required: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
remarks_required_if_no: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
checklist_response: Mapped[str | None] = mapped_column(String(10), nullable=True)
checklist_text_response: Mapped[str | None] = mapped_column(Text, nullable=True)
checklist_number_response: Mapped[float | None] = mapped_column(Numeric(18, 2), nullable=True)
checklist_date_response: Mapped[date | None] = mapped_column(Date, nullable=True)
checklist_remarks: Mapped[str | None] = mapped_column(Text, nullable=True)
# Copied from FirmServiceTaskTemplate at generation time. Existing task
# completion/evidence upload flow is reused to calculate AQMM quality status.
is_aqmm_task: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False, index=True)