]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-change-ownership.ts
feat: show contained playlists under My videos (#5125)
[github/Chocobozzz/PeerTube.git] / server / models / video / video-change-ownership.ts
index ac0ab7e8b9088c1a3158b4696cb5c2bc7dd6c3a0..1a1b8c88de203e55dbff3e1f11f02ab7d351a069 100644 (file)
@@ -1,10 +1,10 @@
 import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
-import { AccountModel } from '../account/account'
-import { ScopeNames as VideoScopeNames, VideoModel } from './video'
+import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '../../../shared/models/videos'
+import { AccountModel } from '../account/account'
 import { getSort } from '../utils'
-import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
-import * as Bluebird from 'bluebird'
+import { ScopeNames as VideoScopeNames, VideoModel } from './video'
 
 enum ScopeNames {
   WITH_ACCOUNTS = 'WITH_ACCOUNTS',
@@ -54,7 +54,7 @@ enum ScopeNames {
     ]
   }
 }))
-export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel> {
+export class VideoChangeOwnershipModel extends Model<Partial<AttributesOnly<VideoChangeOwnershipModel>>> {
   @CreatedAt
   createdAt: Date
 
@@ -119,7 +119,7 @@ export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel>
     ]).then(([ count, rows ]) => ({ total: count, data: rows }))
   }
 
-  static load (id: number): Bluebird<MVideoChangeOwnershipFull> {
+  static load (id: number): Promise<MVideoChangeOwnershipFull> {
     return VideoChangeOwnershipModel.scope([ ScopeNames.WITH_ACCOUNTS, ScopeNames.WITH_VIDEO ])
                                     .findByPk(id)
   }