Merge branch 'preprod'

This commit is contained in:
Vins 2024-05-06 10:51:17 +02:00
commit 73148bbbc4

View File

@ -38,6 +38,7 @@ export default class OfficerRibService extends BaseService {
}
public async createOrUpdate(officeId: string, file: Express.Multer.File) {
console.log("officeId", officeId);
const key = path.join(this.variables.ENV, officeId, file.originalname);
const uploadParams = {
@ -46,11 +47,14 @@ export default class OfficerRibService extends BaseService {
Body: file.buffer, // Example: fs.createReadStream('/path/to/file')
ACL: "public-read", // Optional: Set the ACL if needed
};
console.log("uploadParams", uploadParams);
return new Promise<string>((resolve, reject) => {
this.s3.putObject(uploadParams, function (err, data) {
this.s3.putObject(uploadParams, (err, data) => {
if (err) return reject(err);
resolve(`https://lecoffre-bucket.s3.fr-par.scw.cloud/lecoffre-bucket/${key}`);
// resolve(`https://lecoffre-bucket.s3.fr-par.scw.cloud/lecoffre-bucket/${key}`);
// resolve(`lecoffre.io-bucket.s3.fr-par.scw.cloud/lecoffre-bucket/${key}`);
resolve(this.variables.SCW_BUCKET_ENDPOINT + "/" + this.variables.SCW_BUCKET_NAME + "/" + key)
});
});
}