diff --git a/mealapi/model/meal.py b/mealapi/model/meal.py index eb01a6d..1f5ebe0 100644 --- a/mealapi/model/meal.py +++ b/mealapi/model/meal.py @@ -9,7 +9,7 @@ class Meal(db.Model): description = db.Column(db.Text, nullable=False) kcal = db.Column(db.Integer, nullable=True) price = db.Column(db.Integer, nullable=True) - spicy = db.Column(db.Boolean, nullable=False, default=False) - vegan = db.Column(db.Boolean, nullable=False, default=False) - glutenfree = db.Column(db.Boolean, nullable=False, default=False) + spicy = db.Column(db.Boolean, nullable=True, default=False) + vegan = db.Column(db.Boolean, nullable=True, default=False) + glutenfree = db.Column(db.Boolean, nullable=True, default=False) ingredients = db.relationship('Ingredient', backref='Meal', lazy='dynamic') diff --git a/mealapi/resources/mealresource.py b/mealapi/resources/mealresource.py index c5569ac..9f79be5 100644 --- a/mealapi/resources/mealresource.py +++ b/mealapi/resources/mealresource.py @@ -20,8 +20,8 @@ class MealBaseResource(Resource): db.session.add(mealobj.data) db.session.commit() return '', 204 - except ValidationError: - abort(406, "meal validation error") + except ValidationError as error: + abort(406, error.messages) def get(self): meals = Meal.query.all()