progress: work on inner section of recipe create function
This commit is contained in:
@@ -116,7 +116,7 @@ export class Recipe {
|
||||
}
|
||||
|
||||
async addIngredientToRecipe(ingredient: RecipeIngredient, recipeid: string | number) {
|
||||
const { quantity, unit, id } = ingredient;
|
||||
const { quantity, unit, ingredientid } = ingredient;
|
||||
|
||||
try {
|
||||
const statement = `
|
||||
@@ -125,7 +125,7 @@ export class Recipe {
|
||||
VALUES ($1, $2, $3, $4) RETURNING *
|
||||
`
|
||||
|
||||
const result = await pool.query(statement, [quantity, unit, id, recipeid]);
|
||||
const result = await pool.query(statement, [quantity, unit, ingredientid, recipeid]);
|
||||
|
||||
if (result.rows) return result.rows[0];
|
||||
return [];
|
||||
|
||||
@@ -47,6 +47,8 @@ export interface IIngredient extends HasHistory {
|
||||
export interface RecipeIngredient extends Partial<IIngredient> {
|
||||
unit: string
|
||||
quantity: string | number
|
||||
ingredientid: string | number
|
||||
recipeid: string | number
|
||||
}
|
||||
|
||||
export interface ICollection extends HasHistory, CanDeactivate {
|
||||
|
||||
Reference in New Issue
Block a user