diff --git a/server/src/services/orderItemFulfillmentService.ts b/server/src/services/orderItemFulfillmentService.ts index f3c70eb..0d24634 100644 --- a/server/src/services/orderItemFulfillmentService.ts +++ b/server/src/services/orderItemFulfillmentService.ts @@ -24,13 +24,14 @@ export async function linkOrderItemToPreparation( const cover = Math.max(0, Number(input.inventoryCoverQty) || 0); await db.query( `INSERT INTO order_item_fulfillments ( - order_item_id, order_code, supplier_preparation_id, purchase_code, inventory_cover_qty, updated_at - ) VALUES ($1::uuid, $2, $3::uuid, NULL, $4, NOW()) + order_item_id, order_code, supplier_preparation_id, purchase_code, inventory_cover_qty, direct_delivery_cover, updated_at + ) VALUES ($1::uuid, $2, $3::uuid, NULL, $4, false, NOW()) ON CONFLICT (order_item_id) DO UPDATE SET order_code = EXCLUDED.order_code, supplier_preparation_id = EXCLUDED.supplier_preparation_id, purchase_code = NULL, inventory_cover_qty = EXCLUDED.inventory_cover_qty, + direct_delivery_cover = false, updated_at = NOW()`, [input.orderItemId, input.orderCode, input.preparationId, cover] ); @@ -48,13 +49,14 @@ export async function linkOrderItemToPurchase( const cover = Math.max(0, Number(input.inventoryCoverQty) || 0); await db.query( `INSERT INTO order_item_fulfillments ( - order_item_id, order_code, supplier_preparation_id, purchase_code, inventory_cover_qty, updated_at - ) VALUES ($1::uuid, $2, NULL, $3, $4, NOW()) + order_item_id, order_code, supplier_preparation_id, purchase_code, inventory_cover_qty, direct_delivery_cover, updated_at + ) VALUES ($1::uuid, $2, NULL, $3, $4, false, NOW()) ON CONFLICT (order_item_id) DO UPDATE SET order_code = EXCLUDED.order_code, supplier_preparation_id = NULL, purchase_code = EXCLUDED.purchase_code, inventory_cover_qty = EXCLUDED.inventory_cover_qty, + direct_delivery_cover = false, updated_at = NOW()`, [input.orderItemId, input.orderCode, input.purchaseCode, cover] ); @@ -71,13 +73,14 @@ export async function linkOrderItemToInventoryCover( } await db.query( `INSERT INTO order_item_fulfillments ( - order_item_id, order_code, supplier_preparation_id, purchase_code, inventory_cover_qty, updated_at - ) VALUES ($1::uuid, $2, NULL, NULL, $3, NOW()) + order_item_id, order_code, supplier_preparation_id, purchase_code, inventory_cover_qty, direct_delivery_cover, updated_at + ) VALUES ($1::uuid, $2, NULL, NULL, $3, false, NOW()) ON CONFLICT (order_item_id) DO UPDATE SET order_code = EXCLUDED.order_code, supplier_preparation_id = NULL, purchase_code = NULL, inventory_cover_qty = EXCLUDED.inventory_cover_qty, + direct_delivery_cover = false, updated_at = NOW()`, [input.orderItemId, input.orderCode, cover] );