Skip to content

Commit

Permalink
draft find recipe b00tc4mp#407
Browse files Browse the repository at this point in the history
  • Loading branch information
berlem committed Apr 22, 2024
1 parent e642cb4 commit 12e0d45
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions staff/belen-ivars/project/api/logic/findRecipes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Recipe } from '../data/models.js'

async function findRecipes() {
// const { diet, ingredients } = req.query
const filter = {}
if (diet) filter.diet = diet
if (method) filter.method = method
if (complexity) filter.complexity = complexity
if (time) {
filter.time = { $lte: parseInt(tiempo) }
}
if (ingredients) {
const ingredientList = ingredients.split('-')
filter.ingredients = { $in: ingredientList }
}


const recipes = await Recipe.find(filter)
}

export default findRecipes

0 comments on commit 12e0d45

Please sign in to comment.