Merge branch 'preprod'
This commit is contained in:
commit
73148bbbc4
@ -38,6 +38,7 @@ export default class OfficerRibService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async createOrUpdate(officeId: string, file: Express.Multer.File) {
|
public async createOrUpdate(officeId: string, file: Express.Multer.File) {
|
||||||
|
console.log("officeId", officeId);
|
||||||
const key = path.join(this.variables.ENV, officeId, file.originalname);
|
const key = path.join(this.variables.ENV, officeId, file.originalname);
|
||||||
|
|
||||||
const uploadParams = {
|
const uploadParams = {
|
||||||
@ -46,11 +47,14 @@ export default class OfficerRibService extends BaseService {
|
|||||||
Body: file.buffer, // Example: fs.createReadStream('/path/to/file')
|
Body: file.buffer, // Example: fs.createReadStream('/path/to/file')
|
||||||
ACL: "public-read", // Optional: Set the ACL if needed
|
ACL: "public-read", // Optional: Set the ACL if needed
|
||||||
};
|
};
|
||||||
|
console.log("uploadParams", uploadParams);
|
||||||
|
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
this.s3.putObject(uploadParams, function (err, data) {
|
this.s3.putObject(uploadParams, (err, data) => {
|
||||||
if (err) return reject(err);
|
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)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user