Updated invoice route handler to include dynamic reference types for 'to' and 'from' fields, aligning with recent schema changes.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good

This commit is contained in:
Tom Butcher 2026-06-21 21:29:43 +01:00
parent 6e7419da67
commit 99ef989cc5

View File

@ -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' },