foreignKey: {
allowNull: false
},
- onDelete: 'CASCADE'
+ hooks: true
})
Account: AccountModel
const query = {
offset: start,
limit: count,
- order: [ getSort(sort) ]
+ order: getSort(sort)
}
return VideoChannelModel
static listByAccount (accountId: number) {
const query = {
- order: [ getSort('createdAt') ],
+ order: getSort('createdAt'),
include: [
{
model: AccountModel,
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 {