feat/fix: Adding missing fields to branches/proposals
This commit is contained in:
@@ -29,9 +29,15 @@ function getAndFilterList( query ){
|
|||||||
phone,
|
phone,
|
||||||
city,
|
city,
|
||||||
state,
|
state,
|
||||||
truck_type
|
truck_type,
|
||||||
|
is_accepted,
|
||||||
|
is_withdrawn,
|
||||||
|
is_completed,
|
||||||
} = query;
|
} = query;
|
||||||
|
|
||||||
|
if( is_completed ) { filter_list.push({ is_completed }); }
|
||||||
|
if( is_withdrawn ) { filter_list.push({ is_withdrawn }); }
|
||||||
|
if( is_accepted ) { filter_list.push({ is_accepted }); }
|
||||||
if( shipper ) { filter_list.push({ shipper }); }
|
if( shipper ) { filter_list.push({ shipper }); }
|
||||||
if( carrier ) { filter_list.push({ carrier }); }
|
if( carrier ) { filter_list.push({ carrier }); }
|
||||||
if( load ) { filter_list.push({ load }); }
|
if( load ) { filter_list.push({ load }); }
|
||||||
|
|||||||
@@ -5,12 +5,18 @@ const { GenericHandler } = require( `${ROOT_PATH}/${HANDLERS_PATH}/Generic.handl
|
|||||||
const Model = require( `${ROOT_PATH}/${MODELS_PATH}/loads.model.js` );
|
const Model = require( `${ROOT_PATH}/${MODELS_PATH}/loads.model.js` );
|
||||||
const categoriesModel = require( `${ROOT_PATH}/${MODELS_PATH}/product-categories.model.js` );
|
const categoriesModel = require( `${ROOT_PATH}/${MODELS_PATH}/product-categories.model.js` );
|
||||||
|
|
||||||
const populate_list = ['categories'];
|
const populate_list = ['categories','vehicle'];
|
||||||
|
// last_location_lat
|
||||||
|
// last_location_lng
|
||||||
|
// last_location_geo
|
||||||
|
// last_location_time
|
||||||
|
// background_tracking
|
||||||
const generic = new GenericHandler( Model, null, populate_list );
|
const generic = new GenericHandler( Model, null, populate_list );
|
||||||
|
|
||||||
const getList = async(req, res) => {
|
const getList = async(req, res) => {
|
||||||
const filter = { status : "Published" };
|
const filter = { status : "Published" };
|
||||||
const select = [
|
const select = [
|
||||||
|
"shipment_code",
|
||||||
"categories",
|
"categories",
|
||||||
"truck_type",
|
"truck_type",
|
||||||
"published_date",
|
"published_date",
|
||||||
@@ -19,10 +25,13 @@ const getList = async(req, res) => {
|
|||||||
"weight",
|
"weight",
|
||||||
"est_loading_date",
|
"est_loading_date",
|
||||||
"est_unloading_date",
|
"est_unloading_date",
|
||||||
"origin.city",
|
"origin",
|
||||||
"origin.state",
|
"destination",
|
||||||
"destination.city",
|
"vehicle.last_location_lat",
|
||||||
"destination.state",
|
"vehicle.last_location_lng",
|
||||||
|
"vehicle.last_location_geo",
|
||||||
|
"vehicle.last_location_time",
|
||||||
|
"vehicle.background_tracking"
|
||||||
];
|
];
|
||||||
const { page , elements } = getPagination( req.query );
|
const { page , elements } = getPagination( req.query );
|
||||||
const retVal = await generic.getList(page , elements, filter, select );
|
const retVal = await generic.getList(page , elements, filter, select );
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ const schema = new Schema({
|
|||||||
state: { type: String },
|
state: { type: String },
|
||||||
truck_type: [{ type: String }],
|
truck_type: [{ type: String }],
|
||||||
description:{type: String},
|
description:{type: String},
|
||||||
address : { type: String }
|
address : { type: String },
|
||||||
|
type : { type : 'string' , enum : ['loading', 'unloading', 'both'] },
|
||||||
|
zipcode : { type : 'string', maxLength : 10 },
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = mongoose.model( "branches", schema );
|
module.exports = mongoose.model( "branches", schema );
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ const schema = new Schema({
|
|||||||
|
|
||||||
comment: { type: String },
|
comment: { type: String },
|
||||||
|
|
||||||
is_withdrawn: { type: Boolean, default: false },
|
|
||||||
|
|
||||||
accepted_by: { type: Schema.Types.ObjectId, ref: 'users' },
|
accepted_by: { type: Schema.Types.ObjectId, ref: 'users' },
|
||||||
accepted_date: { type: Date },
|
accepted_date: { type: Date },
|
||||||
|
|
||||||
|
is_withdrawn: { type: Boolean, default: false },
|
||||||
is_accepted: { type: Boolean, default: false },
|
is_accepted: { type: Boolean, default: false },
|
||||||
|
is_completed: { type: Boolean, default: false },
|
||||||
createdAt: { type : Date, required : true, default : () => { return Date.now(); } }
|
createdAt: { type : Date, required : true, default : () => { return Date.now(); } }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user