This commit is contained in:
3
mealapi/schemas/__init__.py
Normal file
3
mealapi/schemas/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
from .marshm import ma
|
||||
from .mealschema import MealSchema
|
||||
from .ingredientschema import IngredientSchema
|
9
mealapi/schemas/ingredientschema.py
Normal file
9
mealapi/schemas/ingredientschema.py
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
from .marshm import ma
|
||||
from ..model import Ingredient
|
||||
|
||||
|
||||
class IngredientSchema(ma.ModelSchema):
|
||||
|
||||
class Meta:
|
||||
model = Ingredient
|
5
mealapi/schemas/marshm.py
Normal file
5
mealapi/schemas/marshm.py
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from flask_marshmallow import Marshmallow
|
||||
|
||||
ma = Marshmallow()
|
13
mealapi/schemas/mealschema.py
Normal file
13
mealapi/schemas/mealschema.py
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
from .marshm import ma
|
||||
from ..model import Meal
|
||||
from .ingredientschema import IngredientSchema
|
||||
|
||||
|
||||
class MealSchema(ma.ModelSchema):
|
||||
|
||||
# A list of author objects
|
||||
authors = ma.Nested(IngredientSchema, many=True)
|
||||
|
||||
class Meta:
|
||||
model = Meal
|
Reference in New Issue
Block a user