def get(self, id): query = '''SELECT id, name FROM ingredients WHERE id = %s''' ingredient = database.fetch(query, id) query = '''SELECT allergies.id, allergies.name FROM allergies INNER JOIN allergies_ingredients ON allergies.id = allergies_ingredients.allergy_id WHERE ingredient_id = %s''' ingredient['allergens'] = database.fetch_all(query, id) return ingredient
def get(self, search): query = '''SELECT id, name FROM allergies WHERE name LIKE %s''' return database.fetch_all(query, f'%{search}%')
def get(self): query = '''SELECT id, name FROM allergies''' return database.fetch_all(query)
def get(self): query = '''SELECT id, name FROM ingredients''' return database.fetch_all(query)