tmpl-fastapi/app/sql/schemas.py

19 lines
336 B
Python
Raw Normal View History

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