From 6b738c7a31591a83fdcd9c78b6b1f98e543c378b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 10:21:38 +0200 Subject: Video channel API routes refractor --- server/models/video/video-channel.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'server/models/video/video-channel.ts') diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 40f3be7fe..4a50af265 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -108,7 +108,7 @@ export class VideoChannelModel extends Model { foreignKey: { allowNull: false }, - onDelete: 'CASCADE' + hooks: true }) Account: AccountModel @@ -234,17 +234,26 @@ export class VideoChannelModel extends Model { toFormattedJSON (): VideoChannel { const actor = this.Actor.toFormattedJSON() - const account = { + const videoChannel = { id: this.id, displayName: this.name, description: this.description, support: this.support, isLocal: this.Actor.isOwned(), createdAt: this.createdAt, - updatedAt: this.updatedAt + updatedAt: this.updatedAt, + ownerAccount: undefined, + videos: undefined + } + + if (this.Account) { + videoChannel.ownerAccount = { + id: this.Account.id, + uuid: this.Account.Actor.uuid + } } - return Object.assign(actor, account) + return Object.assign(actor, videoChannel) } toActivityPubObject (): ActivityPubActor { -- cgit v1.2.3