-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
29 lines (25 loc) · 832 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from uuid import uuid4, UUID
from pydantic import BaseModel
from typing import Optional, Union
# I am aware that this is not the best way to do it (open to suggestions)
class Recipe(BaseModel):
id: Optional[UUID] = uuid4()
title: str
rating: Optional[int]
calories: Optional[Union[str, float]]
protein: Optional[Union[str, float]]
fat: Optional[Union[str, float]]
sodium: Optional[Union[str, float]]
almond: Optional[int]
dairy: Optional[int]
pork: Optional[int]
class RecipeUpdateRequest(BaseModel):
title: Optional[str]
rating: Optional[str]
calories: Optional[Union[str, float]]
protein: Optional[Union[str, float]]
fat: Optional[Union[str, float]]
sodium: Optional[Union[str, float]]
almond: Optional[str]
dairy: Optional[str]
pork: Optional[str]