This commit is contained in:
parent
62e03c7ce3
commit
8a482b83e9
@ -9,7 +9,7 @@ class Meal(db.Model):
|
|||||||
description = db.Column(db.Text, nullable=False)
|
description = db.Column(db.Text, nullable=False)
|
||||||
kcal = db.Column(db.Integer, nullable=True)
|
kcal = db.Column(db.Integer, nullable=True)
|
||||||
price = db.Column(db.Integer, nullable=True)
|
price = db.Column(db.Integer, nullable=True)
|
||||||
spicy = db.Column(db.Boolean, nullable=False, default=False)
|
spicy = db.Column(db.Boolean, nullable=True, default=False)
|
||||||
vegan = db.Column(db.Boolean, nullable=False, default=False)
|
vegan = db.Column(db.Boolean, nullable=True, default=False)
|
||||||
glutenfree = db.Column(db.Boolean, nullable=False, default=False)
|
glutenfree = db.Column(db.Boolean, nullable=True, default=False)
|
||||||
ingredients = db.relationship('Ingredient', backref='Meal', lazy='dynamic')
|
ingredients = db.relationship('Ingredient', backref='Meal', lazy='dynamic')
|
||||||
|
@ -20,8 +20,8 @@ class MealBaseResource(Resource):
|
|||||||
db.session.add(mealobj.data)
|
db.session.add(mealobj.data)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return '', 204
|
return '', 204
|
||||||
except ValidationError:
|
except ValidationError as error:
|
||||||
abort(406, "meal validation error")
|
abort(406, error.messages)
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
meals = Meal.query.all()
|
meals = Meal.query.all()
|
||||||
|
Loading…
Reference in New Issue
Block a user