aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 11:16:23 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 11:16:23 +0200
commit4157cdb13748cb6e8ce7081d062a8778554cc5a7 (patch)
tree149ee35079c1f81f1294f88aa0122dd5c4d55b22 /server/models/video/video.ts
parent96f29c0f6d2e623fb088e88200934c5df8da9924 (diff)
downloadPeerTube-4157cdb13748cb6e8ce7081d062a8778554cc5a7.tar.gz
PeerTube-4157cdb13748cb6e8ce7081d062a8778554cc5a7.tar.zst
PeerTube-4157cdb13748cb6e8ce7081d062a8778554cc5a7.zip
Refractor videos AP functions
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index ce2153f87..6c89c16bf 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1103,14 +1103,24 @@ export class VideoModel extends Model<VideoModel> {
1103 .findOne(options) 1103 .findOne(options)
1104 } 1104 }
1105 1105
1106 static loadByUrlAndPopulateAccount (url: string, t?: Sequelize.Transaction) { 1106 static loadByUrl (url: string, transaction?: Sequelize.Transaction) {
1107 const query: IFindOptions<VideoModel> = { 1107 const query: IFindOptions<VideoModel> = {
1108 where: { 1108 where: {
1109 url 1109 url
1110 } 1110 },
1111 transaction
1111 } 1112 }
1112 1113
1113 if (t !== undefined) query.transaction = t 1114 return VideoModel.findOne(query)
1115 }
1116
1117 static loadByUrlAndPopulateAccount (url: string, transaction?: Sequelize.Transaction) {
1118 const query: IFindOptions<VideoModel> = {
1119 where: {
1120 url
1121 },
1122 transaction
1123 }
1114 1124
1115 return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_FILES ]).findOne(query) 1125 return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_FILES ]).findOne(query)
1116 } 1126 }