48 lines
1,020 B
Python
48 lines
1,020 B
Python
|
|
import uuid
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
from pydantic import BaseModel, ConfigDict
|
||
|
|
|
||
|
|
from api.models.topic import Domain, TopicStatus
|
||
|
|
|
||
|
|
|
||
|
|
class TopicCreate(BaseModel):
|
||
|
|
slug: str
|
||
|
|
title: str
|
||
|
|
description: str | None = None
|
||
|
|
domain: Domain
|
||
|
|
status: TopicStatus = TopicStatus.active
|
||
|
|
|
||
|
|
|
||
|
|
class TopicUpdate(BaseModel):
|
||
|
|
title: str | None = None
|
||
|
|
description: str | None = None
|
||
|
|
domain: Domain | None = None
|
||
|
|
status: TopicStatus | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class WorkstreamStub(BaseModel):
|
||
|
|
model_config = ConfigDict(from_attributes=True)
|
||
|
|
id: uuid.UUID
|
||
|
|
slug: str
|
||
|
|
title: str
|
||
|
|
status: str
|
||
|
|
owner: str | None = None
|
||
|
|
due_date: datetime | None = None
|
||
|
|
|
||
|
|
|
||
|
|
class TopicRead(BaseModel):
|
||
|
|
model_config = ConfigDict(from_attributes=True)
|
||
|
|
id: uuid.UUID
|
||
|
|
slug: str
|
||
|
|
title: str
|
||
|
|
description: str | None = None
|
||
|
|
domain: Domain
|
||
|
|
status: TopicStatus
|
||
|
|
created_at: datetime
|
||
|
|
updated_at: datetime
|
||
|
|
|
||
|
|
|
||
|
|
class TopicWithWorkstreams(TopicRead):
|
||
|
|
workstreams: list[WorkstreamStub] = []
|