fix: Adding filter to public-loads endpoint fix: Adding isVerified field on account_create event
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
"use strict";
|
|
const { ROOT_PATH, LIB_PATH, MODELS_PATH, HANDLERS_PATH } = process.env;
|
|
const { getPagination , getPage } = require( `${ROOT_PATH}/${LIB_PATH}/Misc.js` );
|
|
const { GenericHandler } = require( `${ROOT_PATH}/${HANDLERS_PATH}/Generic.handler.js` );
|
|
const Model = require( `${ROOT_PATH}/${MODELS_PATH}/loads.model.js` );
|
|
const categoriesModel = require( `${ROOT_PATH}/${MODELS_PATH}/product-categories.model.js` );
|
|
|
|
const populate_list = ['categories'];
|
|
const generic = new GenericHandler( Model, null, populate_list );
|
|
|
|
const getList = async(req, res) => {
|
|
const filter = { status : "Published" };
|
|
const select = [
|
|
"categories",
|
|
"truck_type",
|
|
"published_date",
|
|
"createdAt",
|
|
"status",
|
|
"weight",
|
|
"est_loading_date",
|
|
"est_unloading_date",
|
|
"origin.city",
|
|
"origin.state",
|
|
"destination.city",
|
|
"destination.state",
|
|
];
|
|
const { page , elements } = getPagination( req.query );
|
|
const retVal = await generic.getList(page , elements, filter, select );
|
|
res.send( retVal );
|
|
};
|
|
|
|
module.exports = { getList };
|