feat(Shipper): Adding privacy as any other flag to the loads query

This commit is contained in:
Josepablo Cruz
2026-03-31 20:49:52 -06:00
parent db6804145b
commit 8f64b9f304
2 changed files with 4 additions and 16 deletions

View File

@@ -325,7 +325,7 @@ const findList = async(req, res) => {
switch( req.context.user?.company?.company_type ){
case "Shipper":
console.log("Shipper loads finder");
retVal = await ShipperServices.findLoads( companyId, query );
retVal = await ShipperServices.findLoads( query );
break;
case "Carrier":
if( req.context.user?.job_role === "driver" ){

View File

@@ -66,6 +66,7 @@ function getAndFilterList( query ){
truck_type,
state,
city,
privacy,
} = query;
if( company ){ filter_list.push( { company } ); }
@@ -86,6 +87,7 @@ function getAndFilterList( query ){
if( destination_warehouse ) { filter_list.push({ destination_warehouse }); }
if( alert_list ) { filter_list.push({ alert_list }); }
if( truck_type ) { filter_list.push({ truck_type }); }
if( privacy ) { filter_list.push({ privacy }); }
if( state ) {
filter_list.push({
@@ -141,21 +143,7 @@ function getAndFilterList( query ){
return filter_list;
}
async function getCompanyIdListFromGroups( companyId ){
const privateGroups = await companyGroupsModel.find({
allowedCompanies: { $in: [companyId] }
});
if( !privateGroups ){
return null;
}
const companiesIds = privateGroups.map((group) => group.owner);
return companiesIds;
}
async function findLoads( companyId, query ){
async function findLoads( query ){
const { $sort, company_name } = query;
const { page, elements } = getPagination( query );
const andFilterList = getAndFilterList( query ) || [];