26 lines
468 B
Python
26 lines
468 B
Python
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
|
|
class SampleResponse(BaseModel):
|
|
id: int
|
|
title: str
|
|
content: str
|
|
author: str
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class SampleCreate(BaseModel):
|
|
title: str
|
|
content: str
|
|
author: str
|
|
|
|
|
|
class SampleUpdate(BaseModel):
|
|
title: Optional[str] = None
|
|
content: Optional[str] = None
|
|
author: Optional[str] = None
|