Files
the-custodian/state-hub/api/schemas/technical_debt.py
tegwick b1ae98678c feat(suggestions): full suggestion workflow with per-step notes
DB migration h5c6d7e8f9a0:
- Extends tdstatus enum: submitted → analyse → plan → implement →
  test → review → finished (+ wont_fix remains)
- New td_notes table: td_id FK (CASCADE), step, author, content, created_at

API:
- TDNote model + TDNoteCreate/TDNoteRead schemas
- TDRead includes notes[] (selectin loaded)
- New routes: GET/POST /technical-debt/{id}/notes/
- list_td status filter accepts str (all enum values)

Modal: new submissions use status="submitted" instead of "open"

UI Feedback page revamp:
- Visual step-by-step stepper (submitted→analyse→plan→implement→test→review→finished)
- Per-step notes: view all notes, add note inline
- Action buttons: advance to next step, won't fix
- Review step highlighted as awaiting original suggester confirmation
- Closed items (finished/wont_fix) shown with last 2 notes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 00:57:34 +01:00

68 lines
1.6 KiB
Python

import uuid
from datetime import datetime
from pydantic import BaseModel, ConfigDict
from api.models.technical_debt import TDStatus
VALID_SEVERITIES = {"low", "medium", "high", "critical"}
class TDNoteCreate(BaseModel):
step: str
author: str | None = None
content: str
class TDNoteRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: uuid.UUID
td_id: uuid.UUID
step: str
author: str | None = None
content: str
created_at: datetime
class TDCreate(BaseModel):
td_id: str | None = None
domain: str # slug; router resolves to domain_id FK
title: str
description: str | None = None
location: str | None = None
debt_type: str = "other"
severity: str = "medium"
status: TDStatus = TDStatus.open
topic_id: uuid.UUID | None = None
workstream_id: uuid.UUID | None = None
class TDUpdate(BaseModel):
title: str | None = None
description: str | None = None
location: str | None = None
debt_type: str | None = None
severity: str | None = None
status: TDStatus | None = None
workstream_id: uuid.UUID | None = None
class TDRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: uuid.UUID
td_id: str | None = None
domain_slug: str # derived from domain relationship
title: str
description: str | None = None
location: str | None = None
debt_type: str
severity: str
status: TDStatus
topic_id: uuid.UUID | None = None
workstream_id: uuid.UUID | None = None
created_at: datetime
updated_at: datetime
notes: list[TDNoteRead] = []