From 99ef989cc55c0933163059145c52c19932337c48 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 21 Jun 2026 21:29:43 +0100 Subject: [PATCH] Updated invoice route handler to include dynamic reference types for 'to' and 'from' fields, aligning with recent schema changes. --- src/services/finance/invoices.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/finance/invoices.js b/src/services/finance/invoices.js index 8d3b460..921cba6 100644 --- a/src/services/finance/invoices.js +++ b/src/services/finance/invoices.js @@ -87,8 +87,8 @@ export const listInvoicesByPropertiesRouteHandler = async ( export const getInvoiceRouteHandler = async (req, res) => { const id = req.params.id; const populateFields = [ - { path: 'to', strictPopulate: false }, - { path: 'from', strictPopulate: false }, + { path: 'to', strictPopulate: false, ref: 'toType' }, + { path: 'from', strictPopulate: false, ref: 'fromType' }, { path: 'order' }, { path: 'invoiceOrderItems.taxRate' }, { path: 'invoiceShipments.taxRate' },