diff options
Diffstat (limited to 'server/models/video/video-blacklist.ts')
-rw-r--r-- | server/models/video/video-blacklist.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index 36d2a30fa..aa18896da 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts | |||
@@ -1,14 +1,13 @@ | |||
1 | import { FindOptions } from 'sequelize' | ||
1 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | import { getBlacklistSort, SortType, throwIfNotValid, searchAttribute } from '../utils' | 3 | import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/models' |
3 | import { VideoModel } from './video' | ||
4 | import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel' | ||
5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' | ||
6 | import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' | 4 | import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' |
5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' | ||
7 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 6 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
8 | import { FindOptions } from 'sequelize' | 7 | import { getBlacklistSort, searchAttribute, SortType, throwIfNotValid } from '../utils' |
9 | import { ThumbnailModel } from './thumbnail' | 8 | import { ThumbnailModel } from './thumbnail' |
10 | import * as Bluebird from 'bluebird' | 9 | import { VideoModel } from './video' |
11 | import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/models' | 10 | import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from './video-channel' |
12 | 11 | ||
13 | @Table({ | 12 | @Table({ |
14 | tableName: 'videoBlacklist', | 13 | tableName: 'videoBlacklist', |
@@ -19,7 +18,7 @@ import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/model | |||
19 | } | 18 | } |
20 | ] | 19 | ] |
21 | }) | 20 | }) |
22 | export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | 21 | export class VideoBlacklistModel extends Model { |
23 | 22 | ||
24 | @AllowNull(true) | 23 | @AllowNull(true) |
25 | @Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason', true)) | 24 | @Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason', true)) |
@@ -109,7 +108,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | |||
109 | }) | 108 | }) |
110 | } | 109 | } |
111 | 110 | ||
112 | static loadByVideoId (id: number): Bluebird<MVideoBlacklist> { | 111 | static loadByVideoId (id: number): Promise<MVideoBlacklist> { |
113 | const query = { | 112 | const query = { |
114 | where: { | 113 | where: { |
115 | videoId: id | 114 | videoId: id |