aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/models/video/video.ts28
1 files changed, 11 insertions, 17 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 6b825bf93..391568df4 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -94,15 +94,25 @@ enum ScopeNames {
94 [ScopeNames.WITH_ACCOUNT_DETAILS]: { 94 [ScopeNames.WITH_ACCOUNT_DETAILS]: {
95 include: [ 95 include: [
96 { 96 {
97 model: () => VideoChannelModel, 97 model: () => VideoChannelModel.unscoped(),
98 required: true, 98 required: true,
99 include: [ 99 include: [
100 { 100 {
101 attributes: {
102 exclude: [ 'privateKey', 'publicKey' ]
103 },
104 model: () => ActorModel,
105 required: true
106 },
107 {
101 model: () => AccountModel, 108 model: () => AccountModel,
102 required: true, 109 required: true,
103 include: [ 110 include: [
104 { 111 {
105 model: () => ActorModel, 112 model: () => ActorModel,
113 attributes: {
114 exclude: [ 'privateKey', 'publicKey' ]
115 },
106 required: true, 116 required: true,
107 include: [ 117 include: [
108 { 118 {
@@ -511,22 +521,6 @@ export class VideoModel extends Model<VideoModel> {
511 return VideoModel.findById(id) 521 return VideoModel.findById(id)
512 } 522 }
513 523
514 static loadAndPopulateAccount (id: number) {
515 return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS ]).findById(id)
516 }
517
518 static loadByUrl (url: string, t?: Sequelize.Transaction) {
519 const query: IFindOptions<VideoModel> = {
520 where: {
521 url
522 }
523 }
524
525 if (t !== undefined) query.transaction = t
526
527 return VideoModel.findOne(query)
528 }
529
530 static loadByUrlAndPopulateAccount (url: string, t?: Sequelize.Transaction) { 524 static loadByUrlAndPopulateAccount (url: string, t?: Sequelize.Transaction) {
531 const query: IFindOptions<VideoModel> = { 525 const query: IFindOptions<VideoModel> = {
532 where: { 526 where: {