Skip to content

Commit 9df98d6

Browse files
committed
removed userid from food variant table during food variant creation.
1 parent 11983e1 commit 9df98d6

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

SparkyFitnessServer/models/food.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,14 @@ async function createFood(foodData: any) {
181181
// 2. Create the primary food variant and mark it as default
182182
const variantResult = await client.query(
183183
`INSERT INTO food_variants (
184-
food_id, user_id, serving_size, serving_unit, calories, protein, carbs, fat,
184+
food_id, serving_size, serving_unit, calories, protein, carbs, fat,
185185
saturated_fat, polyunsaturated_fat, monounsaturated_fat, trans_fat,
186186
cholesterol, sodium, potassium, dietary_fiber, sugars,
187187
vitamin_a, vitamin_c, calcium, iron, is_default, glycemic_index, custom_nutrients,
188188
source, ai_confidence, allergens, traces, created_at, updated_at
189-
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, TRUE, $22, $23, $24, $25, $26, $27, now(), now()) RETURNING id`,
189+
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, TRUE, $21, $22, $23, $24, $25, $26, now(), now()) RETURNING id`,
190190
[
191191
newFood.id,
192-
newFood.user_id,
193192
sanitizeNumeric(foodData.serving_size),
194193
foodData.serving_unit,
195194
sanitizeNumeric(foodData.calories),
@@ -804,19 +803,17 @@ async function createFoodsInBulk(userId: any, foodDataArray: any) {
804803
for (const variant of food.variants) {
805804
await client.query(
806805
`INSERT INTO food_variants (
807-
food_id, user_id, serving_size, serving_unit, is_default, calories, protein, carbs, fat,
806+
food_id, serving_size, serving_unit, is_default, calories, protein, carbs, fat,
808807
saturated_fat, polyunsaturated_fat, monounsaturated_fat, trans_fat,
809808
cholesterol, sodium, potassium, dietary_fiber, sugars,
810809
vitamin_a, vitamin_c, calcium, iron, glycemic_index, custom_nutrients,
811810
source, ai_confidence, allergens, traces, created_at, updated_at
812811
) VALUES (
813812
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14,
814-
$15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, now(), now()
813+
$15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, now(), now()
815814
)`,
816815
[
817816
newFoodId,
818-
// @ts-expect-error TS(2571): Object is of type 'unknown'.
819-
food.user_id,
820817
sanitizeNumeric(variant.serving_size),
821818
variant.serving_unit,
822819
sanitizeBoolean(variant.is_default) ?? true,

0 commit comments

Comments
 (0)