feat: Add support for S3 transfer acceleration
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
Table,
|
||||
DataType,
|
||||
} from "sequelize-typescript";
|
||||
import { deleteFromS3, getFileByKey } from "@server/utils/s3";
|
||||
import { publicS3Endpoint, deleteFromS3, getFileByKey } from "@server/utils/s3";
|
||||
import Document from "./Document";
|
||||
import Team from "./Team";
|
||||
import User from "./User";
|
||||
@@ -55,6 +55,14 @@ class Attachment extends BaseModel {
|
||||
return getFileByKey(this.key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this instead of url which will be deleted soon, the column is unneccessary
|
||||
* and was not updated with the migraiton to the new s3 bucket.
|
||||
*/
|
||||
get canonicalUrl() {
|
||||
return `${publicS3Endpoint()}/${this.key}`;
|
||||
}
|
||||
|
||||
// hooks
|
||||
|
||||
@BeforeDestroy
|
||||
|
||||
Reference in New Issue
Block a user