fix: Add load.categories to the populate of proposals

This commit is contained in:
Josepablo C
2024-03-20 21:21:55 -06:00
parent bb397c8ca0
commit a87ecaad74

View File

@@ -1,11 +1,14 @@
"use strict"; "use strict";
const { populate } = require("dotenv");
const { ROOT_PATH, LIB_PATH, MODELS_PATH, HANDLERS_PATH } = process.env; const { ROOT_PATH, LIB_PATH, MODELS_PATH, HANDLERS_PATH } = process.env;
const { getModel } = require( `${ROOT_PATH}/${MODELS_PATH}` ); const { getModel } = require( `${ROOT_PATH}/${MODELS_PATH}` );
const { getPagination } = require( `${ROOT_PATH}/${LIB_PATH}/Misc.js` ); const { getPagination } = require( `${ROOT_PATH}/${LIB_PATH}/Misc.js` );
const { GenericHandler } = require( `${ROOT_PATH}/${HANDLERS_PATH}/Generic.handler.js` ); const { GenericHandler } = require( `${ROOT_PATH}/${HANDLERS_PATH}/Generic.handler.js` );
const Model = getModel('proposals'); const Model = getModel('proposals');
const populate_list = ['load', 'shipper','carrier','vehicle','bidder','accepted_by']; const populate_list = [{ path:'load' , populate : { path : 'categories' } }, 'shipper','carrier','vehicle','bidder','accepted_by'];
const generic = new GenericHandler( Model, null, populate_list ); const generic = new GenericHandler( Model, null, populate_list );
function getAndFilterList( query ){ function getAndFilterList( query ){