aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-25 10:21:38 +0200
committerChocobozzz <me@florianbigard.com>2018-04-25 13:50:48 +0200
commit6b738c7a31591a83fdcd9c78b6b1f98e543c378b (patch)
treedb771d0e99e9ff27570885fe2a6f58a7c1948fbc /server/models/video/video-channel.ts
parent48dce1c90dff4e90a4bcffefaecf157336cf904b (diff)
downloadPeerTube-6b738c7a31591a83fdcd9c78b6b1f98e543c378b.tar.gz
PeerTube-6b738c7a31591a83fdcd9c78b6b1f98e543c378b.tar.zst
PeerTube-6b738c7a31591a83fdcd9c78b6b1f98e543c378b.zip
Video channel API routes refractor
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r--server/models/video/video-channel.ts17
1 files changed, 13 insertions, 4 deletions
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<VideoChannelModel> {
108 foreignKey: { 108 foreignKey: {
109 allowNull: false 109 allowNull: false
110 }, 110 },
111 onDelete: 'CASCADE' 111 hooks: true
112 }) 112 })
113 Account: AccountModel 113 Account: AccountModel
114 114
@@ -234,17 +234,26 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
234 234
235 toFormattedJSON (): VideoChannel { 235 toFormattedJSON (): VideoChannel {
236 const actor = this.Actor.toFormattedJSON() 236 const actor = this.Actor.toFormattedJSON()
237 const account = { 237 const videoChannel = {
238 id: this.id, 238 id: this.id,
239 displayName: this.name, 239 displayName: this.name,
240 description: this.description, 240 description: this.description,
241 support: this.support, 241 support: this.support,
242 isLocal: this.Actor.isOwned(), 242 isLocal: this.Actor.isOwned(),
243 createdAt: this.createdAt, 243 createdAt: this.createdAt,
244 updatedAt: this.updatedAt 244 updatedAt: this.updatedAt,
245 ownerAccount: undefined,
246 videos: undefined
247 }
248
249 if (this.Account) {
250 videoChannel.ownerAccount = {
251 id: this.Account.id,
252 uuid: this.Account.Actor.uuid
253 }
245 } 254 }
246 255
247 return Object.assign(actor, account) 256 return Object.assign(actor, videoChannel)
248 } 257 }
249 258
250 toActivityPubObject (): ActivityPubActor { 259 toActivityPubObject (): ActivityPubActor {