feat(companies): Adding field to carrier/shipper query
This commit is contained in:
@@ -340,8 +340,10 @@ This endpoint is part of /loads endpoint
|
||||
|
||||
- `GET /own` : Get own company data.
|
||||
- `PATCH /own` : Update own company data.
|
||||
- `GET /shipper` : Get list of shipper companies with pagination using the following filters: company_type, company_name, truck_type, categories, company_state, company_city
|
||||
- `GET /shipper` : Get list of shipper companies with pagination using the following filters: company_type, company_name, truck_type, categories, company_state, company_city.
|
||||
- $sort[ field ] : -1/1 ; Sort result by field name
|
||||
- `GET /carrier` : Get list of carrier companies with pagination using the following filters: company_type, company_name, truck_type, categories, company_state, company_city
|
||||
- $sort[ field ] : -1/1 ; Sort result by field name
|
||||
- `GET /users/:companyId` : Get the list of users within a company.
|
||||
- `GET /:id` : Get data from specific company.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
const { ROOT_PATH, MODELS_PATH, HANDLERS_PATH, LIB_PATH } = process.env;
|
||||
const { getModel } = require( `${ROOT_PATH}/${MODELS_PATH}` );
|
||||
const { GenericHandler } = require( `${ROOT_PATH}/${HANDLERS_PATH}/Generic.handler.js` );
|
||||
const { GenericHandler } = require( '../../../lib/Handlers/Generic.handler.js' );
|
||||
const { getPagination } = require( `${ROOT_PATH}/${LIB_PATH}/Misc.js` );
|
||||
|
||||
const usersModel = getModel('users');
|
||||
@@ -61,6 +61,7 @@ async function getListByType( type , req ){
|
||||
"truck_type",
|
||||
"company_description"
|
||||
];
|
||||
const { $sort } = req.query;
|
||||
const { elements , page } = getPagination( req.query );
|
||||
let query_elements;
|
||||
if( elements >= 100 ){
|
||||
@@ -75,7 +76,7 @@ async function getListByType( type , req ){
|
||||
filter.$and = andFilterList;
|
||||
}
|
||||
|
||||
const queryVal = await generic.getList(page , query_elements, filter, select );
|
||||
const queryVal = await generic.getList(page , query_elements, filter, select, $sort );
|
||||
const data_list = queryVal.data;
|
||||
for(let i=0; i<data_list.length; i++){
|
||||
data_list[i] = data_list[i].toObject();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const { ROOT_PATH, LIB_PATH } = process.env;
|
||||
const { getModel } = require( '../../../lib/Models' );
|
||||
const { getPagination } = require( `${ROOT_PATH}/${LIB_PATH}/Misc.js` );
|
||||
const { GenericHandler } = require( '../../../lib/Handlers//Generic.handler.js' );
|
||||
const { GenericHandler } = require( '../../../lib/Handlers/Generic.handler.js' );
|
||||
const Model = getModel('loads');
|
||||
const CompanyModel = getModel('companies');
|
||||
const ProposalsModel = getModel('proposals');
|
||||
|
||||
Reference in New Issue
Block a user