Compare commits

..

1 Commits

Author SHA1 Message Date
e9965c38ff [PIE-29] New recipe form submission (#15)
Basic form submission of recipe. Not everything is handled yet: images, tags, and step-associated-ingredients are not handled, as they do not have an interface in the recipe form yet.
Co-authored-by: June <self@breadone.net>
Co-committed-by: June <self@breadone.net>
2025-08-22 16:43:40 +12:00

View File

@@ -81,17 +81,25 @@ async function addRecipe() {
console.log(comps.ings) console.log(comps.ings)
const ingredientIDs = await Promise.all( const ingredientIDs = await Promise.all(
comps.ings.map(async it => (await client.pb.collection('ingredients').create({ comps.ings.map(async it => (await client.pb.collection('ingredients').create(it)).id) // get the id of the returned record
'quantity': it.quantity,
'name': it.name,
'unit': it.name
})).id) // get the id of the returned record
) )
const stepIds = await Promise.all( const stepIDs = await Promise.all(
comps.stepList.map(async it => (await client.pb.collection('steps').create(it)).id)
) )
const recipe = await client.pb.collection('recipes').create({
name: comps.name,
description: comps.description,
servings: comps.servings,
worktime: comps.worktime,
waittime: comps.waittime,
rating: comps.rating,
ingredients: ingredientIDs,
steps: stepIDs
})
console.log(recipe)
} }
function addIngredient() { function addIngredient() {