/
mialdr
/
python_advanced
Обзор
Документация
Войти
/
mialdr
/
python_advanced
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
module_26_fastapi/homework/schemas.py
48 строк
793 B
Mikhail
module26 update
04 апр 2024, 22:15
04 апр 2024, 22:15
b80bd13
Код
Авторство
О чём код?
from pydantic import BaseModel class BaseDish(BaseModel): title: str cooking_time: int class DishIn(BaseDish): ingredients: list['IngredientIn'] description: str class DishOutReadDishes(BaseDish): id: int number_views: int class DishOutReadDish(BaseDish): id: int ingredients: list['IngredientOut'] description: str class DishOutCreateDish(BaseDish): id: int ingredients: list['IngredientOut'] description: str number_views: int class DishUpdate(BaseModel): title: str = None cooking_time: int = None ingredients: list['IngredientIn'] = None description: str = None class BaseIngredient(BaseModel): title: str class IngredientIn(BaseIngredient): ... class IngredientOut(BaseIngredient): id: int