diff options
Diffstat (limited to 'server/models/video/video-import.ts')
-rw-r--r-- | server/models/video/video-import.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index eca87163d..55fca28b8 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts | |||
@@ -21,6 +21,7 @@ import { VideoImport, VideoImportState } from '../../../shared' | |||
21 | import { VideoChannelModel } from './video-channel' | 21 | import { VideoChannelModel } from './video-channel' |
22 | import { AccountModel } from '../account/account' | 22 | import { AccountModel } from '../account/account' |
23 | import { TagModel } from './tag' | 23 | import { TagModel } from './tag' |
24 | import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos' | ||
24 | 25 | ||
25 | @DefaultScope({ | 26 | @DefaultScope({ |
26 | include: [ | 27 | include: [ |
@@ -62,11 +63,23 @@ export class VideoImportModel extends Model<VideoImportModel> { | |||
62 | @UpdatedAt | 63 | @UpdatedAt |
63 | updatedAt: Date | 64 | updatedAt: Date |
64 | 65 | ||
65 | @AllowNull(false) | 66 | @AllowNull(true) |
67 | @Default(null) | ||
66 | @Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl')) | 68 | @Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl')) |
67 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) | 69 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) |
68 | targetUrl: string | 70 | targetUrl: string |
69 | 71 | ||
72 | @AllowNull(true) | ||
73 | @Default(null) | ||
74 | @Is('VideoImportMagnetUri', value => throwIfNotValid(value, isVideoMagnetUriValid, 'magnetUri')) | ||
75 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) // Use the same constraints than URLs | ||
76 | magnetUri: string | ||
77 | |||
78 | @AllowNull(true) | ||
79 | @Default(null) | ||
80 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_NAME.max)) | ||
81 | torrentName: string | ||
82 | |||
70 | @AllowNull(false) | 83 | @AllowNull(false) |
71 | @Default(null) | 84 | @Default(null) |
72 | @Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state')) | 85 | @Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state')) |