diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-abuse.ts | 1 | ||||
-rw-r--r-- | server/models/video/video-blacklist.ts | 11 | ||||
-rw-r--r-- | server/models/video/video.ts | 31 |
3 files changed, 35 insertions, 8 deletions
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts index 10a191372..dbb88ca45 100644 --- a/server/models/video/video-abuse.ts +++ b/server/models/video/video-abuse.ts | |||
@@ -137,7 +137,6 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> { | |||
137 | video: { | 137 | video: { |
138 | id: this.Video.id, | 138 | id: this.Video.id, |
139 | uuid: this.Video.uuid, | 139 | uuid: this.Video.uuid, |
140 | url: this.Video.url, | ||
141 | name: this.Video.name | 140 | name: this.Video.name |
142 | }, | 141 | }, |
143 | createdAt: this.createdAt | 142 | createdAt: this.createdAt |
diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index 1b8a338cb..eabc37ef0 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts | |||
@@ -16,7 +16,7 @@ import { getSortOnModel, throwIfNotValid } from '../utils' | |||
16 | import { VideoModel } from './video' | 16 | import { VideoModel } from './video' |
17 | import { isVideoBlacklistReasonValid } from '../../helpers/custom-validators/video-blacklist' | 17 | import { isVideoBlacklistReasonValid } from '../../helpers/custom-validators/video-blacklist' |
18 | import { Emailer } from '../../lib/emailer' | 18 | import { Emailer } from '../../lib/emailer' |
19 | import { BlacklistedVideo } from '../../../shared/models/videos' | 19 | import { VideoBlacklist } from '../../../shared/models/videos' |
20 | import { CONSTRAINTS_FIELDS } from '../../initializers' | 20 | import { CONSTRAINTS_FIELDS } from '../../initializers' |
21 | 21 | ||
22 | @Table({ | 22 | @Table({ |
@@ -68,7 +68,12 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | |||
68 | offset: start, | 68 | offset: start, |
69 | limit: count, | 69 | limit: count, |
70 | order: getSortOnModel(sort.sortModel, sort.sortValue), | 70 | order: getSortOnModel(sort.sortModel, sort.sortValue), |
71 | include: [ { model: VideoModel } ] | 71 | include: [ |
72 | { | ||
73 | model: VideoModel, | ||
74 | required: true | ||
75 | } | ||
76 | ] | ||
72 | } | 77 | } |
73 | 78 | ||
74 | return VideoBlacklistModel.findAndCountAll(query) | 79 | return VideoBlacklistModel.findAndCountAll(query) |
@@ -90,7 +95,7 @@ export class VideoBlacklistModel extends Model<VideoBlacklistModel> { | |||
90 | return VideoBlacklistModel.findOne(query) | 95 | return VideoBlacklistModel.findOne(query) |
91 | } | 96 | } |
92 | 97 | ||
93 | toFormattedJSON (): BlacklistedVideo { | 98 | toFormattedJSON (): VideoBlacklist { |
94 | const video = this.Video | 99 | const video = this.Video |
95 | 100 | ||
96 | return { | 101 | return { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index f3a900bc9..b13dee403 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -127,7 +127,8 @@ export enum ScopeNames { | |||
127 | WITH_ACCOUNT_DETAILS = 'WITH_ACCOUNT_DETAILS', | 127 | WITH_ACCOUNT_DETAILS = 'WITH_ACCOUNT_DETAILS', |
128 | WITH_TAGS = 'WITH_TAGS', | 128 | WITH_TAGS = 'WITH_TAGS', |
129 | WITH_FILES = 'WITH_FILES', | 129 | WITH_FILES = 'WITH_FILES', |
130 | WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE' | 130 | WITH_SCHEDULED_UPDATE = 'WITH_SCHEDULED_UPDATE', |
131 | WITH_BLACKLISTED = 'WITH_BLACKLISTED' | ||
131 | } | 132 | } |
132 | 133 | ||
133 | type AvailableForListOptions = { | 134 | type AvailableForListOptions = { |
@@ -374,6 +375,15 @@ type AvailableForListOptions = { | |||
374 | [ScopeNames.WITH_TAGS]: { | 375 | [ScopeNames.WITH_TAGS]: { |
375 | include: [ () => TagModel ] | 376 | include: [ () => TagModel ] |
376 | }, | 377 | }, |
378 | [ScopeNames.WITH_BLACKLISTED]: { | ||
379 | include: [ | ||
380 | { | ||
381 | attributes: [ 'id', 'reason' ], | ||
382 | model: () => VideoBlacklistModel, | ||
383 | required: false | ||
384 | } | ||
385 | ] | ||
386 | }, | ||
377 | [ScopeNames.WITH_FILES]: { | 387 | [ScopeNames.WITH_FILES]: { |
378 | include: [ | 388 | include: [ |
379 | { | 389 | { |
@@ -1004,7 +1014,13 @@ export class VideoModel extends Model<VideoModel> { | |||
1004 | } | 1014 | } |
1005 | 1015 | ||
1006 | return VideoModel | 1016 | return VideoModel |
1007 | .scope([ ScopeNames.WITH_TAGS, ScopeNames.WITH_FILES, ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_SCHEDULED_UPDATE ]) | 1017 | .scope([ |
1018 | ScopeNames.WITH_TAGS, | ||
1019 | ScopeNames.WITH_BLACKLISTED, | ||
1020 | ScopeNames.WITH_FILES, | ||
1021 | ScopeNames.WITH_ACCOUNT_DETAILS, | ||
1022 | ScopeNames.WITH_SCHEDULED_UPDATE | ||
1023 | ]) | ||
1008 | .findById(id, options) | 1024 | .findById(id, options) |
1009 | } | 1025 | } |
1010 | 1026 | ||
@@ -1030,7 +1046,13 @@ export class VideoModel extends Model<VideoModel> { | |||
1030 | } | 1046 | } |
1031 | 1047 | ||
1032 | return VideoModel | 1048 | return VideoModel |
1033 | .scope([ ScopeNames.WITH_TAGS, ScopeNames.WITH_FILES, ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_SCHEDULED_UPDATE ]) | 1049 | .scope([ |
1050 | ScopeNames.WITH_TAGS, | ||
1051 | ScopeNames.WITH_BLACKLISTED, | ||
1052 | ScopeNames.WITH_FILES, | ||
1053 | ScopeNames.WITH_ACCOUNT_DETAILS, | ||
1054 | ScopeNames.WITH_SCHEDULED_UPDATE | ||
1055 | ]) | ||
1034 | .findOne(options) | 1056 | .findOne(options) |
1035 | } | 1057 | } |
1036 | 1058 | ||
@@ -1276,7 +1298,8 @@ export class VideoModel extends Model<VideoModel> { | |||
1276 | toFormattedDetailsJSON (): VideoDetails { | 1298 | toFormattedDetailsJSON (): VideoDetails { |
1277 | const formattedJson = this.toFormattedJSON({ | 1299 | const formattedJson = this.toFormattedJSON({ |
1278 | additionalAttributes: { | 1300 | additionalAttributes: { |
1279 | scheduledUpdate: true | 1301 | scheduledUpdate: true, |
1302 | blacklistInfo: true | ||
1280 | } | 1303 | } |
1281 | }) | 1304 | }) |
1282 | 1305 | ||