29 lines
674 B
Python
29 lines
674 B
Python
"""Artifact schemas."""
|
|||
|
|
from pydantic import BaseModel, Field
|
||
|
|
from typing import Optional
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
|
||
|
|
class ArtifactCreate(BaseModel):
|
||
|
|
title: str = Field(..., min_length=1, max_length=500)
|
||
|
|
content: str = ""
|
||
|
|
artifact_type: str = "text"
|
||
|
|
sources: str = "[]"
|
||
|
|
|
||
|
|
|
||
|
|
class ArtifactResponse(BaseModel):
|
||
|
|
id: int
|
||
|
|
task_id: int
|
||
|
|
project_id: int
|
||
|
|
title: str
|
||
|
|
content: str
|
||
|
|
artifact_type: str
|
||
|
|
version: int
|
||
|
|
is_latest: str
|
||
|
|
created_by_user_id: Optional[int] = None
|
||
|
|
created_by_worker_id: Optional[int] = None
|
||
|
|
sources: str = "[]"
|
||
|
|
tenant_id: int
|
||
|
|
created_at: datetime
|
||
|
|
|
||
|
|
model_config = {"from_attributes": True}
|