import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
+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 '../shared'
import { ScopeNames as VideoScopeNames, VideoModel } from './video'
-import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '../../../shared/models/videos'
-import { getSort } from '../utils'
-import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
-import * as Bluebird from 'bluebird'
enum ScopeNames {
WITH_ACCOUNTS = 'WITH_ACCOUNTS',
]
}
}))
-export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel> {
+export class VideoChangeOwnershipModel extends Model<Partial<AttributesOnly<VideoChangeOwnershipModel>>> {
@CreatedAt
createdAt: Date
]).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)
}