Beispiel #1
0
    def get(self):
        uuid = request.args.get("uuid")
        if not uuid:
            return {
                'message': "Missing uuid parameter",
                'description': {
                    'search_key': 'uuid',
                    'search_value': uuid
                }
            }, 404

        recipe = RecipeModel.findby_id(uuid)
        if recipe:
            return recipe_schema.dump(recipe), 200
        return {'message': "Recipe not found", 'description': uuid}, 404
Beispiel #2
0
    def delete(self):
        uuid = request.args.get('uuid')
        if not uuid:
            return {
                'message': "Missing uuid parameter",
                'description': {
                    'search_key': 'uuid',
                    'search_value': uuid
                }
            }, 404

        recipe = RecipeModel.findby_id(uuid)
        if recipe:
            recipe.deletefrom_db()
            return {'message': 'Recipe deleted', 'description': uuid}
        return {'message': 'Recipe not found', 'description': uuid}, 404