15 lines
276 B
Python
15 lines
276 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
|
|
class PostsBase(BaseModel):
|
|
title: str
|
|
content: str
|
|
published: bool = True
|
|
rating: Optional[int] = None
|
|
|
|
class Posts(PostsBase):
|
|
id: int
|
|
user_id: int
|
|
|
|
class Config:
|
|
orm_mode = True |