]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-channel.ts
Cleanup server fixme
[github/Chocobozzz/PeerTube.git] / server / models / video / video-channel.ts
index 7178631b47119ee3efc251255b11fcda5bdaa4bc..4e98e7ba3f064333176f8a30c2e87c98365c7518 100644 (file)
@@ -43,18 +43,6 @@ import {
   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',
@@ -176,7 +164,16 @@ export type SummaryOptions = {
 }))
 @Table({
   tableName: 'videoChannel',
-  indexes
+  indexes: [
+    buildTrigramSearchIndex('video_channel_name_trigram', 'name'),
+
+    {
+      fields: [ 'accountId' ]
+    },
+    {
+      fields: [ 'actorId' ]
+    }
+  ]
 })
 export class VideoChannelModel extends Model<VideoChannelModel> {
 
@@ -249,7 +246,7 @@ 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()) {
@@ -517,7 +514,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
   }
 
   toActivityPubObject (this: MChannelAP): ActivityPubActor {
-    const obj = this.Actor.toActivityPubObject(this.name, 'VideoChannel')
+    const obj = this.Actor.toActivityPubObject(this.name)
 
     return Object.assign(obj, {
       summary: this.description,