diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-18 11:28:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:20 +0200 |
commit | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (patch) | |
tree | 7bbb442f2cb4d7be58a4e08d87f5974403a3047c /server/models/video/video-blacklist.ts | |
parent | e8bafea35bc930cb8ac5b2d521a188642a1adffe (diff) | |
download | PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.tar.gz PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.tar.zst PeerTube-1735c825726edaa0af5035cb6cbb0cc0db502c6d.zip |
Update sequelize
Diffstat (limited to 'server/models/video/video-blacklist.ts')
-rw-r--r-- | server/models/video/video-blacklist.ts | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index 2619b4950..d9fe9dfc9 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts | |||
@@ -1,22 +1,11 @@ | |||
1 | import { | 1 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
2 | AllowNull, | ||
3 | BelongsTo, | ||
4 | Column, | ||
5 | CreatedAt, | ||
6 | DataType, | ||
7 | Default, | ||
8 | ForeignKey, | ||
9 | Is, Model, | ||
10 | Table, | ||
11 | UpdatedAt, | ||
12 | IFindOptions | ||
13 | } from 'sequelize-typescript' | ||
14 | import { getSortOnModel, SortType, throwIfNotValid } from '../utils' | 2 | import { getSortOnModel, SortType, throwIfNotValid } from '../utils' |
15 | import { VideoModel } from './video' | 3 | import { VideoModel } from './video' |
16 | import { VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel' | 4 | import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' |
17 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' | 5 | import { isVideoBlacklistReasonValid, isVideoBlacklistTypeValid } from '../../helpers/custom-validators/video-blacklist' |
18 | import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' | 6 | import { VideoBlacklist, VideoBlacklistType } from '../../../shared/models/videos' |
19 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 7 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
8 | import { FindOptions } from 'sequelize' | ||
20 | 9 | ||
21 | @Table({ | 10 | @Table({ |
22 | tableName: 'videoBlacklist', | 11 | tableName: 'videoBlacklist', |
@@ -30,7 +19,7 @@ import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | |||
30 | export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | 19 | export class VideoBlacklistModel extends Model<VideoBlacklistModel> { |
31 | 20 | ||
32 | @AllowNull(true) | 21 | @AllowNull(true) |
33 | @Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason')) | 22 | @Is('VideoBlacklistReason', value => throwIfNotValid(value, isVideoBlacklistReasonValid, 'reason', true)) |
34 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max)) | 23 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max)) |
35 | reason: string | 24 | reason: string |
36 | 25 | ||
@@ -63,7 +52,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | |||
63 | Video: VideoModel | 52 | Video: VideoModel |
64 | 53 | ||
65 | static listForApi (start: number, count: number, sort: SortType, type?: VideoBlacklistType) { | 54 | static listForApi (start: number, count: number, sort: SortType, type?: VideoBlacklistType) { |
66 | const query: IFindOptions<VideoBlacklistModel> = { | 55 | const query: FindOptions = { |
67 | offset: start, | 56 | offset: start, |
68 | limit: count, | 57 | limit: count, |
69 | order: getSortOnModel(sort.sortModel, sort.sortValue), | 58 | order: getSortOnModel(sort.sortModel, sort.sortValue), |