tmpl-fastapi/app/sql/schemas.py

19 lines
336 B
Python
Raw Permalink Normal View History

from pydantic import BaseModel # pylint: disable=no-name-in-module
2023-02-19 16:49:44 +03:00
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