diff --git a/v1/src/apps/private/proposals/services.js b/v1/src/apps/private/proposals/services.js index f40bb78..e3b3bb5 100644 --- a/v1/src/apps/private/proposals/services.js +++ b/v1/src/apps/private/proposals/services.js @@ -29,9 +29,15 @@ function getAndFilterList( query ){ phone, city, state, - truck_type + truck_type, + is_accepted, + is_withdrawn, + is_completed, } = 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( carrier ) { filter_list.push({ carrier }); } if( load ) { filter_list.push({ load }); } diff --git a/v1/src/apps/public/public-loads/services.js b/v1/src/apps/public/public-loads/services.js index 1c0a428..53c2681 100644 --- a/v1/src/apps/public/public-loads/services.js +++ b/v1/src/apps/public/public-loads/services.js @@ -5,12 +5,18 @@ const { GenericHandler } = require( `${ROOT_PATH}/${HANDLERS_PATH}/Generic.handl 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 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 getList = async(req, res) => { const filter = { status : "Published" }; const select = [ + "shipment_code", "categories", "truck_type", "published_date", @@ -19,10 +25,13 @@ const getList = async(req, res) => { "weight", "est_loading_date", "est_unloading_date", - "origin.city", - "origin.state", - "destination.city", - "destination.state", + "origin", + "destination", + "vehicle.last_location_lat", + "vehicle.last_location_lng", + "vehicle.last_location_geo", + "vehicle.last_location_time", + "vehicle.background_tracking" ]; const { page , elements } = getPagination( req.query ); const retVal = await generic.getList(page , elements, filter, select ); diff --git a/v1/src/lib/Models/branches.model.js b/v1/src/lib/Models/branches.model.js index c60ed64..f24d4e5 100644 --- a/v1/src/lib/Models/branches.model.js +++ b/v1/src/lib/Models/branches.model.js @@ -10,7 +10,9 @@ const schema = new Schema({ state: { type: String }, truck_type: [{ 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 ); diff --git a/v1/src/lib/Models/proposals.model.js b/v1/src/lib/Models/proposals.model.js index 9fc71c6..9099638 100644 --- a/v1/src/lib/Models/proposals.model.js +++ b/v1/src/lib/Models/proposals.model.js @@ -11,11 +11,12 @@ const schema = new Schema({ comment: { type: String }, - is_withdrawn: { type: Boolean, default: false }, - accepted_by: { type: Schema.Types.ObjectId, ref: 'users' }, accepted_date: { type: Date }, + + is_withdrawn: { 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(); } } });