tmpl-fastapi/app/sql/schemas.py

19 lines
299 B
Python
Raw Normal View History

2023-02-19 16:49:44 +03:00
from pydantic import BaseModel
2023-02-27 18:05:04 +03:00
# Pydantic class for
# INSERT queries on a User model
2023-02-20 11:09:43 +03:00
class UserCreate(BaseModel):
2023-02-19 16:49:44 +03:00
email: str
name: str
age: int
2023-02-20 11:09:43 +03:00
2023-02-27 18:05:04 +03:00
# Pydantic class for
# SELECT responses with User model(-s)
2023-02-20 11:09:43 +03:00
class User(UserCreate):
id: int
2023-02-19 16:49:44 +03:00
class Config:
orm_mode = True