18 lines
412 B
Python
18 lines
412 B
Python
from typing import Optional
|
|
from datetime import datetime
|
|
from pydantic import BaseModel
|
|
class PostsCreate(BaseModel):
|
|
title: str
|
|
content: str
|
|
published: bool = True
|
|
author_id: int
|
|
class Posts(BaseModel):
|
|
id: int
|
|
title: str
|
|
content: str
|
|
published: bool
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
author_id: int
|
|
class Config:
|
|
orm_mode = True |