50 lines
1.2 KiB
Python
50 lines
1.2 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 TDCreate(BaseModel):
|
||
|
|
td_id: str | None = None
|
||
|
|
domain: str
|
||
|
|
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: str
|
||
|
|
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
|