diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/user.ts | 4 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 11 | ||||
-rw-r--r-- | server/models/video/video.ts | 14 |
3 files changed, 14 insertions, 15 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 24b1626e7..cb54d79af 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -55,7 +55,7 @@ import { UserAdminFlag } from '../../../shared/models/users/user-flag.model' | |||
55 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' | 55 | import { isThemeNameValid } from '../../helpers/custom-validators/plugins' |
56 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' | 56 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' |
57 | import * as Bluebird from 'bluebird' | 57 | import * as Bluebird from 'bluebird' |
58 | import { MUserChannel, MUserDefault, MUserId, MUserWithNotificationSetting } from '@server/typings/models' | 58 | import { MUserNotifSettingChannelDefault, MUserDefault, MUserId, MUserWithNotificationSetting } from '@server/typings/models' |
59 | 59 | ||
60 | enum ScopeNames { | 60 | enum ScopeNames { |
61 | WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' | 61 | WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' |
@@ -384,7 +384,7 @@ export class UserModel extends Model<UserModel> { | |||
384 | return UserModel.findOne(query) | 384 | return UserModel.findOne(query) |
385 | } | 385 | } |
386 | 386 | ||
387 | static loadByUsernameAndPopulateChannels (username: string): Bluebird<MUserChannel> { | 387 | static loadByUsernameAndPopulateChannels (username: string): Bluebird<MUserNotifSettingChannelDefault> { |
388 | const query = { | 388 | const query = { |
389 | where: { | 389 | where: { |
390 | username: { [ Op.iLike ]: username } | 390 | username: { [ Op.iLike ]: username } |
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 79b9e7d2b..b6a60827f 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -37,7 +37,6 @@ import * as Bluebird from 'bluebird' | |||
37 | import { | 37 | import { |
38 | MChannelAccountDefault, | 38 | MChannelAccountDefault, |
39 | MChannelActor, | 39 | MChannelActor, |
40 | MChannelActorAccountDefault, | ||
41 | MChannelActorAccountDefaultVideos | 40 | MChannelActorAccountDefaultVideos |
42 | } from '../../typings/models/video' | 41 | } from '../../typings/models/video' |
43 | 42 | ||
@@ -376,13 +375,13 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
376 | }) | 375 | }) |
377 | } | 376 | } |
378 | 377 | ||
379 | static loadByIdAndPopulateAccount (id: number): Bluebird<MChannelActorAccountDefault> { | 378 | static loadByIdAndPopulateAccount (id: number): Bluebird<MChannelAccountDefault> { |
380 | return VideoChannelModel.unscoped() | 379 | return VideoChannelModel.unscoped() |
381 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) | 380 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) |
382 | .findByPk(id) | 381 | .findByPk(id) |
383 | } | 382 | } |
384 | 383 | ||
385 | static loadByIdAndAccount (id: number, accountId: number): Bluebird<MChannelActorAccountDefault> { | 384 | static loadByIdAndAccount (id: number, accountId: number): Bluebird<MChannelAccountDefault> { |
386 | const query = { | 385 | const query = { |
387 | where: { | 386 | where: { |
388 | id, | 387 | id, |
@@ -395,7 +394,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
395 | .findOne(query) | 394 | .findOne(query) |
396 | } | 395 | } |
397 | 396 | ||
398 | static loadAndPopulateAccount (id: number): Bluebird<MChannelActorAccountDefault> { | 397 | static loadAndPopulateAccount (id: number): Bluebird<MChannelAccountDefault> { |
399 | return VideoChannelModel.unscoped() | 398 | return VideoChannelModel.unscoped() |
400 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) | 399 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) |
401 | .findByPk(id) | 400 | .findByPk(id) |
@@ -427,7 +426,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
427 | return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) | 426 | return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) |
428 | } | 427 | } |
429 | 428 | ||
430 | static loadLocalByNameAndPopulateAccount (name: string): Bluebird<MChannelActorAccountDefault> { | 429 | static loadLocalByNameAndPopulateAccount (name: string): Bluebird<MChannelAccountDefault> { |
431 | const query = { | 430 | const query = { |
432 | include: [ | 431 | include: [ |
433 | { | 432 | { |
@@ -446,7 +445,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
446 | .findOne(query) | 445 | .findOne(query) |
447 | } | 446 | } |
448 | 447 | ||
449 | static loadByNameAndHostAndPopulateAccount (name: string, host: string): Bluebird<MChannelActorAccountDefault> { | 448 | static loadByNameAndHostAndPopulateAccount (name: string, host: string): Bluebird<MChannelAccountDefault> { |
450 | const query = { | 449 | const query = { |
451 | include: [ | 450 | include: [ |
452 | { | 451 | { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 7b1f0bc31..e62bde344 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -121,18 +121,18 @@ import { createTorrentPromise } from '../../helpers/webtorrent' | |||
121 | import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' | 121 | import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' |
122 | import { | 122 | import { |
123 | MChannel, | 123 | MChannel, |
124 | MChannelActorAccountDefault, | 124 | MChannelAccountDefault, |
125 | MChannelId, | 125 | MChannelId, |
126 | MUserAccountId, | 126 | MUserAccountId, |
127 | MUserId, | 127 | MUserId, |
128 | MVideoAccountAllFiles, | ||
129 | MVideoAccountLight, | 128 | MVideoAccountLight, |
129 | MVideoAccountLightBlacklistAllFiles, | ||
130 | MVideoDetails, | 130 | MVideoDetails, |
131 | MVideoForUser, | ||
131 | MVideoFullLight, | 132 | MVideoFullLight, |
132 | MVideoIdThumbnail, | 133 | MVideoIdThumbnail, |
133 | MVideoThumbnail, | 134 | MVideoThumbnail, |
134 | MVideoWithAllFiles, | 135 | MVideoWithAllFiles, |
135 | MVideoWithBlacklistThumbnailScheduled, | ||
136 | MVideoWithRights | 136 | MVideoWithRights |
137 | } from '../../typings/models' | 137 | } from '../../typings/models' |
138 | import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' | 138 | import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' |
@@ -1015,7 +1015,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1015 | AccountModel | 1015 | AccountModel |
1016 | ], | 1016 | ], |
1017 | transaction: options.transaction | 1017 | transaction: options.transaction |
1018 | }) as MChannelActorAccountDefault | 1018 | }) as MChannelAccountDefault |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | return sendDeleteVideo(instance, options.transaction) | 1021 | return sendDeleteVideo(instance, options.transaction) |
@@ -1209,10 +1209,10 @@ export class VideoModel extends Model<VideoModel> { | |||
1209 | 1209 | ||
1210 | return Promise.all([ | 1210 | return Promise.all([ |
1211 | VideoModel.count(countQuery), | 1211 | VideoModel.count(countQuery), |
1212 | VideoModel.scope(findScopes).findAll(findQuery) | 1212 | VideoModel.scope(findScopes).findAll<MVideoForUser>(findQuery) |
1213 | ]).then(([ count, rows ]) => { | 1213 | ]).then(([ count, rows ]) => { |
1214 | return { | 1214 | return { |
1215 | data: rows as MVideoWithBlacklistThumbnailScheduled[], | 1215 | data: rows, |
1216 | total: count | 1216 | total: count |
1217 | } | 1217 | } |
1218 | }) | 1218 | }) |
@@ -1468,7 +1468,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1468 | return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query) | 1468 | return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query) |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | static loadByUrlAndPopulateAccount (url: string, transaction?: Transaction): Bluebird<MVideoAccountAllFiles> { | 1471 | static loadByUrlAndPopulateAccount (url: string, transaction?: Transaction): Bluebird<MVideoAccountLightBlacklistAllFiles> { |
1472 | const query: FindOptions = { | 1472 | const query: FindOptions = { |
1473 | where: { | 1473 | where: { |
1474 | url | 1474 | url |