17 lines
295 B
Python
17 lines
295 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
class PostsBase(BaseModel):
|
|
title: str
|
|
content: str
|
|
|
|
class PostsCreate(PostsBase):
|
|
pass
|
|
|
|
class Posts(PostsBase):
|
|
id: int
|
|
is_published: bool
|
|
rating: Optional[int] = None
|
|
|
|
class Config:
|
|
orm_mode = True |