now files do presigned url setup
This commit is contained in:
@@ -43,6 +43,33 @@ export class FileController {
|
||||
});
|
||||
}
|
||||
|
||||
getFileAccessUrl(
|
||||
fctx: FlowExecCtx,
|
||||
fileId: string,
|
||||
userId: string,
|
||||
expiresIn: number = 3600,
|
||||
) {
|
||||
return traceResultAsync({
|
||||
name: "logic.files.controller.getFileAccessUrl",
|
||||
fctx,
|
||||
attributes: {
|
||||
"app.user.id": userId,
|
||||
"app.file.id": fileId,
|
||||
"app.file.access_ttl_sec": expiresIn,
|
||||
},
|
||||
fn: () =>
|
||||
this.fileRepo
|
||||
.getFileById(fctx, fileId, userId)
|
||||
.andThen((file) =>
|
||||
this.storageRepo.generatePresignedDownloadUrl(
|
||||
fctx,
|
||||
file.objectKey,
|
||||
expiresIn,
|
||||
),
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
uploadFile(
|
||||
fctx: FlowExecCtx,
|
||||
userId: string,
|
||||
|
||||
Reference in New Issue
Block a user