diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-21 14:28:06 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-21 14:40:10 +0100 |
commit | 9b39106d5757caf221a88e42e05167a6fac479c6 (patch) | |
tree | ce3ac7907135d82ad13abf648eff4f963448227e /server/models/video | |
parent | 374c1db98cf22527f5b362c70d3c50e3be4c8885 (diff) | |
download | PeerTube-9b39106d5757caf221a88e42e05167a6fac479c6.tar.gz PeerTube-9b39106d5757caf221a88e42e05167a6fac479c6.tar.zst PeerTube-9b39106d5757caf221a88e42e05167a6fac479c6.zip |
findById -> findByPk
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-change-ownership.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 6 | ||||
-rw-r--r-- | server/models/video/video-file.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-import.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-streaming-playlist.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/server/models/video/video-change-ownership.ts b/server/models/video/video-change-ownership.ts index 48c07728f..85e688c4f 100644 --- a/server/models/video/video-change-ownership.ts +++ b/server/models/video/video-change-ownership.ts | |||
@@ -110,7 +110,7 @@ export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel> | |||
110 | } | 110 | } |
111 | 111 | ||
112 | static load (id: number) { | 112 | static load (id: number) { |
113 | return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findById(id) | 113 | return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findByPk(id) |
114 | } | 114 | } |
115 | 115 | ||
116 | toFormattedJSON (): VideoChangeOwnership { | 116 | toFormattedJSON (): VideoChangeOwnership { |
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 91dd0440c..2426b3de6 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -320,7 +320,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
320 | static loadByIdAndPopulateAccount (id: number) { | 320 | static loadByIdAndPopulateAccount (id: number) { |
321 | return VideoChannelModel.unscoped() | 321 | return VideoChannelModel.unscoped() |
322 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) | 322 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) |
323 | .findById(id) | 323 | .findByPk(id) |
324 | } | 324 | } |
325 | 325 | ||
326 | static loadByIdAndAccount (id: number, accountId: number) { | 326 | static loadByIdAndAccount (id: number, accountId: number) { |
@@ -339,7 +339,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
339 | static loadAndPopulateAccount (id: number) { | 339 | static loadAndPopulateAccount (id: number) { |
340 | return VideoChannelModel.unscoped() | 340 | return VideoChannelModel.unscoped() |
341 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) | 341 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) |
342 | .findById(id) | 342 | .findByPk(id) |
343 | } | 343 | } |
344 | 344 | ||
345 | static loadByUUIDAndPopulateAccount (uuid: string) { | 345 | static loadByUUIDAndPopulateAccount (uuid: string) { |
@@ -439,7 +439,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> { | |||
439 | 439 | ||
440 | return VideoChannelModel.unscoped() | 440 | return VideoChannelModel.unscoped() |
441 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEOS ]) | 441 | .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEOS ]) |
442 | .findById(id, options) | 442 | .findByPk(id, options) |
443 | } | 443 | } |
444 | 444 | ||
445 | toFormattedJSON (): VideoChannel { | 445 | toFormattedJSON (): VideoChannel { |
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 7d1e371b9..b861b0704 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -117,7 +117,7 @@ export class VideoFileModel extends Model<VideoFileModel> { | |||
117 | ] | 117 | ] |
118 | } | 118 | } |
119 | 119 | ||
120 | return VideoFileModel.findById(id, options) | 120 | return VideoFileModel.findByPk(id, options) |
121 | } | 121 | } |
122 | 122 | ||
123 | static async getStats () { | 123 | static async getStats () { |
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index c723e57c0..9bc0f17f5 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts | |||
@@ -115,7 +115,7 @@ export class VideoImportModel extends Model<VideoImportModel> { | |||
115 | } | 115 | } |
116 | 116 | ||
117 | static loadAndPopulateVideo (id: number) { | 117 | static loadAndPopulateVideo (id: number) { |
118 | return VideoImportModel.findById(id) | 118 | return VideoImportModel.findByPk(id) |
119 | } | 119 | } |
120 | 120 | ||
121 | static listUserVideoImportsForApi (userId: number, start: number, count: number, sort: string) { | 121 | static listUserVideoImportsForApi (userId: number, start: number, count: number, sort: string) { |
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts index bf6f7b0c4..e489f9b0e 100644 --- a/server/models/video/video-streaming-playlist.ts +++ b/server/models/video/video-streaming-playlist.ts | |||
@@ -110,7 +110,7 @@ export class VideoStreamingPlaylistModel extends Model<VideoStreamingPlaylistMod | |||
110 | ] | 110 | ] |
111 | } | 111 | } |
112 | 112 | ||
113 | return VideoStreamingPlaylistModel.findById(id, options) | 113 | return VideoStreamingPlaylistModel.findByPk(id, options) |
114 | } | 114 | } |
115 | 115 | ||
116 | static getHlsPlaylistFilename (resolution: number) { | 116 | static getHlsPlaylistFilename (resolution: number) { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index fe81fab1a..4516b9c7b 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1313,7 +1313,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1313 | 1313 | ||
1314 | static loadWithFiles (id: number, t?: Sequelize.Transaction, logging?: boolean) { | 1314 | static loadWithFiles (id: number, t?: Sequelize.Transaction, logging?: boolean) { |
1315 | return VideoModel.scope([ ScopeNames.WITH_FILES, ScopeNames.WITH_STREAMING_PLAYLISTS ]) | 1315 | return VideoModel.scope([ ScopeNames.WITH_FILES, ScopeNames.WITH_STREAMING_PLAYLISTS ]) |
1316 | .findById(id, { transaction: t, logging }) | 1316 | .findByPk(id, { transaction: t, logging }) |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | static loadByUUIDWithFile (uuid: string) { | 1319 | static loadByUUIDWithFile (uuid: string) { |