def delete(self, user_id): user = db_session.query(User).get(user_id) if user: db_session.delete(user) db_session.commit() return jsonify(_parse_user(user, detailed=False)) return make_response(jsonify({ 'type': 'error', 'text': 'not found' }), 404)
def delete(self, comment_id): comment = db_session.query(Comment).get(comment_id) if comment: db_session.delete(comment) db_session.commit() return jsonify(_parse_comment(comment, detailed=False)) return make_response(jsonify({ 'type': 'error', 'text': 'not found' }), 404)
def delete(self, meal_id): meal = db_session.query(Meal).get(meal_id) if meal: db_session.delete(meal) db_session.commit() return jsonify(_parse_meal(meal, detailed=False)) return make_response(jsonify({ 'type': 'error', 'text': 'not found' }), 404)
def delete(self, order_id): order = db_session.query(Order).get(order_id) if order: _order_date = order.order_date if not self._check_actual_date(_order_date.timetuple().tm_yday): return make_response(jsonify({'type': 'error', 'text': 'not allowed remove old order'}), 403) db_session.delete(order) db_session.commit() return jsonify(_parse_order(order, detailed=False)) return make_response(jsonify({'type': 'error', 'text': 'not found'}), 404)