chore: Audit of all model column validations (#3757)
* chore: Updating all model validations before the white-hatters get to it ;) * test * Remove isUrl validation, thinking about it need to account for minio and other weird urls here
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
IsIn,
|
||||
Table,
|
||||
DataType,
|
||||
IsNumeric,
|
||||
} from "sequelize-typescript";
|
||||
import { publicS3Endpoint, deleteFromS3, getFileByKey } from "@server/utils/s3";
|
||||
import Document from "./Document";
|
||||
@@ -15,19 +16,33 @@ import Team from "./Team";
|
||||
import User from "./User";
|
||||
import IdModel from "./base/IdModel";
|
||||
import Fix from "./decorators/Fix";
|
||||
import Length from "./validators/Length";
|
||||
|
||||
@Table({ tableName: "attachments", modelName: "attachment" })
|
||||
@Fix
|
||||
class Attachment extends IdModel {
|
||||
@Length({
|
||||
max: 4096,
|
||||
msg: "key must be 4096 characters or less",
|
||||
})
|
||||
@Column
|
||||
key: string;
|
||||
|
||||
@Length({
|
||||
max: 4096,
|
||||
msg: "url must be 4096 characters or less",
|
||||
})
|
||||
@Column
|
||||
url: string;
|
||||
|
||||
@Length({
|
||||
max: 255,
|
||||
msg: "contentType must be 255 characters or less",
|
||||
})
|
||||
@Column
|
||||
contentType: string;
|
||||
|
||||
@IsNumeric
|
||||
@Column(DataType.BIGINT)
|
||||
size: number;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user