fix(S3): load attachement key was wrong

This commit is contained in:
Josepablo C
2024-04-06 18:34:56 -06:00
parent e904c83cb5
commit 1a279aea87
2 changed files with 2 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ const s3Client = new S3Client({
} }
}); });
const s3Bucket = apiConfig.S3.bucket; const s3Bucket = apiConfig.S3.bucket;
const s3BucketKey = apiConfig.S3.key; const s3BucketKey = apiConfig.S3.load_attachments_key;
const Model = require( `${ROOT_PATH}/${MODELS_PATH}/load-attachments.model.js` ); const Model = require( `${ROOT_PATH}/${MODELS_PATH}/load-attachments.model.js` );
const UserModel = require( `${ROOT_PATH}/${MODELS_PATH}/users.model.js` ); const UserModel = require( `${ROOT_PATH}/${MODELS_PATH}/users.model.js` );

View File

@@ -68,16 +68,7 @@ async function findElements( companyId , query ){
} }
async function findElementById( elementId , companyId ){ async function findElementById( elementId , companyId ){
const filter = { let retVal = await Model.findById( elementId ).populate( populate_list ) || {};
$and : [
{ _id : elementId },
{ $or :[
{ shipper : companyId },
{ carrier : companyId }
]}
]
};
let retVal = await Model.findOne( filter ).populate( populate_list ) || {};
return retVal; return retVal;
} }