refactor: upload now return presigned url instead of redirect
This will prevent from payload upload to API Server first and then upload to MinIO which cause upload to be happens twice.
This commit is contained in:
parent
ddc5a9a037
commit
d5ab07bacb
4 changed files with 4 additions and 6 deletions
|
|
@ -738,7 +738,7 @@ export class BranchFileController extends Controller {
|
|||
@Path() name: string,
|
||||
) {
|
||||
await this.checkPermission(req.user, branchId);
|
||||
return req.res?.redirect(await setFile(fileLocation.branch.attachment(branchId, name)));
|
||||
return await setFile(fileLocation.branch.attachment(branchId, name));
|
||||
}
|
||||
|
||||
@Delete("attachment/{name}")
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ export class CustomerBranchFileController extends Controller {
|
|||
@Path() name: string,
|
||||
) {
|
||||
await this.checkPermission(req.user, branchId);
|
||||
return req.res?.redirect(await setFile(fileLocation.customerBranch.attachment(branchId, name)));
|
||||
return await setFile(fileLocation.customerBranch.attachment(branchId, name));
|
||||
}
|
||||
|
||||
@Delete("attachment/{name}")
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ export class EmployeeFileController extends Controller {
|
|||
@Path() name: string,
|
||||
) {
|
||||
await this.checkPermission(req.user, employeeId);
|
||||
return req.res?.redirect(await setFile(fileLocation.employee.attachment(employeeId, name)));
|
||||
return await setFile(fileLocation.employee.attachment(employeeId, name));
|
||||
}
|
||||
|
||||
@Delete("attachment/{name}")
|
||||
|
|
|
|||
|
|
@ -141,9 +141,7 @@ export class QuotationPayment extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
return req.res?.redirect(
|
||||
await setFile(fileLocation.quotation.payment(quotationId, paymentId, name)),
|
||||
);
|
||||
return await setFile(fileLocation.quotation.payment(quotationId, paymentId, name));
|
||||
}
|
||||
|
||||
@Delete("{paymentId}/attachment/{name}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue