import {
MChannelAccountDefault,
MChannelActor,
- MChannelActorAccountDefaultVideos
+ 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
.findByPk(id, options)
}
- toFormattedJSON (): VideoChannel {
+ toFormattedSummaryJSON (this: MChannelSummaryFormattable): VideoChannelSummary {
+ const actor = this.Actor.toFormattedSummaryJSON()
+
+ return {
+ id: this.id,
+ name: actor.name,
+ displayName: this.getDisplayName(),
+ url: actor.url,
+ host: actor.host,
+ avatar: actor.avatar
+ }
+ }
+
+ toFormattedJSON (this: MChannelFormattable): VideoChannel {
const actor = this.Actor.toFormattedJSON()
const videoChannel = {
id: this.id,
return Object.assign(actor, videoChannel)
}
- toFormattedSummaryJSON (): VideoChannelSummary {
- const actor = this.Actor.toFormattedJSON()
-
- return {
- id: this.id,
- name: actor.name,
- displayName: this.getDisplayName(),
- url: actor.url,
- host: actor.host,
- avatar: actor.avatar
- }
- }
-
- toActivityPubObject (): ActivityPubActor {
+ toActivityPubObject (this: MChannelAP): ActivityPubActor {
const obj = this.Actor.toActivityPubObject(this.name, 'VideoChannel')
return Object.assign(obj, {