feat(loads): Adding shipper_warehouse field to loads model
This commit is contained in:
@@ -373,6 +373,7 @@ This endpoint is part of /loads endpoint
|
||||
- categories
|
||||
- product
|
||||
- shipment_code
|
||||
- shipper_warehouse : id of a company branch
|
||||
- company_name[$regex] : Regex string to find company_name
|
||||
- company_name[$options] : Regex options from MongoDB filter description
|
||||
- $sort[ field ] : -1/1 ; Sort result by field name
|
||||
|
||||
@@ -5,8 +5,9 @@ const { GenericHandler } = require( '../../../lib/Handlers/Generic.handler.js' )
|
||||
const Model = getModel('loads');
|
||||
const CompanyModel = getModel('companies');
|
||||
const ProposalsModel = getModel('proposals');
|
||||
const branchesModel = getModel('branches');
|
||||
|
||||
const populate_list = ['product', 'company', 'carrier', 'vehicle', 'categories'];
|
||||
const populate_list = ['product', 'company', 'carrier', 'vehicle', 'categories','shipper_warehouse'];
|
||||
const generic = new GenericHandler( Model, null, populate_list );
|
||||
|
||||
function getAndFilterList( query ){
|
||||
@@ -25,7 +26,8 @@ function getAndFilterList( query ){
|
||||
transit_date,
|
||||
categories,
|
||||
product,
|
||||
shipment_code
|
||||
shipment_code,
|
||||
shipper_warehouse
|
||||
} = query;
|
||||
|
||||
if( company ){ filter_list.push( { company } ); }
|
||||
@@ -42,6 +44,7 @@ function getAndFilterList( query ){
|
||||
if( categories ) { filter_list.push({ categories }); }
|
||||
if( product ) { filter_list.push({ product }); }
|
||||
if( shipment_code ) { filter_list.push({ shipment_code }); }
|
||||
if( shipper_warehouse ) { filter_list.push({ shipper_warehouse }); }
|
||||
|
||||
if( filter_list.length == 0 ){
|
||||
return null;
|
||||
|
||||
@@ -41,6 +41,8 @@ const schema = new Schema({
|
||||
posted_by_name: { type: String }, // search purpose
|
||||
bidder: { type: Schema.Types.ObjectId, ref: 'users' },
|
||||
|
||||
shipper_warehouse : { type: Schema.Types.ObjectId, ref: 'branches' },
|
||||
|
||||
origin: address,
|
||||
origin_geo: {
|
||||
type: pointSchema,
|
||||
|
||||
Reference in New Issue
Block a user