state-hub/api/schemas/extension_point.py

51 lines
1.3 KiB
Python
Raw Normal View History

import uuid
from datetime import datetime
from pydantic import BaseModel, ConfigDict
from api.models.extension_point import EPStatus
VALID_PRIORITIES = {"low", "medium", "high", "critical"}
class EPCreate(BaseModel):
ep_id: str | None = None
domain: str # slug; router resolves to domain_id FK
title: str
description: str | None = None
location: str | None = None
ep_type: str = "other"
status: EPStatus = EPStatus.open
priority: str = "medium"
topic_id: uuid.UUID | None = None
workstream_id: uuid.UUID | None = None
class EPUpdate(BaseModel):
ep_id: str | None = None
title: str | None = None
description: str | None = None
location: str | None = None
ep_type: str | None = None
status: EPStatus | None = None
priority: str | None = None
workstream_id: uuid.UUID | None = None
class EPRead(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: uuid.UUID
ep_id: str | None = None
domain_slug: str # derived from domain relationship
title: str
description: str | None = None
location: str | None = None
ep_type: str
status: EPStatus
priority: str
topic_id: uuid.UUID | None = None
workstream_id: uuid.UUID | None = None
created_at: datetime
updated_at: datetime