fix: write cook assignments with legacy bridge schema
This commit is contained in:
@@ -91,6 +91,14 @@ function saveCookAssignment(meal, cookUserId, sourcePlanId, createdBy) {
|
||||
const columns = tableColumns('planned_meal_cooks');
|
||||
const insertColumns = ['meal_id', 'user_id', 'planned_for_date', 'meal_type', 'source_plan_id', 'created_by', 'updated_at'];
|
||||
const values = [meal.id, cookUserId, meal.date, meal.meal_type, sourcePlanId || null, createdBy, new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')];
|
||||
if (columns.has('meal_date')) {
|
||||
insertColumns.push('meal_date');
|
||||
values.push(meal.date);
|
||||
}
|
||||
if (columns.has('meal_title')) {
|
||||
insertColumns.push('meal_title');
|
||||
values.push(meal.title || null);
|
||||
}
|
||||
if (columns.has('id')) {
|
||||
insertColumns.unshift('id');
|
||||
values.unshift(crypto.randomUUID());
|
||||
|
||||
Reference in New Issue
Block a user