import {
MChannelAccountDefault,
MChannelActor,
- MChannelActorAccountDefaultVideos, MChannelSummaryFormattable, MChannelFormattable
+ MChannelActorAccountDefaultVideos,
+ MChannelAP,
+ MChannelFormattable,
+ MChannelSummaryFormattable
} from '../../typings/models/video'
-// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation
-const indexes: ModelIndexesOptions[] = [
- buildTrigramSearchIndex('video_channel_name_trigram', 'name'),
-
- {
- fields: [ 'accountId' ]
- },
- {
- fields: [ 'actorId' ]
- }
-]
-
export enum ScopeNames {
FOR_API = 'FOR_API',
WITH_ACCOUNT = 'WITH_ACCOUNT',
}))
@Table({
tableName: 'videoChannel',
- indexes
+ indexes: [
+ buildTrigramSearchIndex('video_channel_name_trigram', 'name'),
+
+ {
+ fields: [ 'accountId' ]
+ },
+ {
+ fields: [ 'actorId' ]
+ }
+ ]
})
export class VideoChannelModel extends Model<VideoChannelModel> {
@BeforeDestroy
static async sendDeleteIfOwned (instance: VideoChannelModel, options) {
if (!instance.Actor) {
- instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
+ instance.Actor = await instance.$get('Actor', { transaction: options.transaction })
}
if (instance.Actor.isOwned()) {
return Object.assign(actor, videoChannel)
}
- toActivityPubObject (): ActivityPubActor {
- const obj = this.Actor.toActivityPubObject(this.name, 'VideoChannel')
+ toActivityPubObject (this: MChannelAP): ActivityPubActor {
+ const obj = this.Actor.toActivityPubObject(this.name)
return Object.assign(obj, {
summary: this.description,