2019-08-15 05:53:26 -04:00
|
|
|
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
2019-08-20 07:52:49 -04:00
|
|
|
import {
|
|
|
|
MActor,
|
|
|
|
MActorChannelAccountActor,
|
|
|
|
MActorDefault,
|
2019-11-15 09:06:03 -05:00
|
|
|
MActorDefaultAccountChannel,
|
2019-08-20 13:05:31 -04:00
|
|
|
MActorFormattable,
|
2019-08-20 07:52:49 -04:00
|
|
|
MActorHost,
|
|
|
|
MActorUsername
|
|
|
|
} from './actor'
|
2019-08-15 05:53:26 -04:00
|
|
|
import { PickWith } from '../../utils'
|
2019-08-20 07:52:49 -04:00
|
|
|
import { ActorModel } from '@server/models/activitypub/actor'
|
2019-11-15 09:06:03 -05:00
|
|
|
import { MChannelDefault } from '../video/video-channels'
|
2019-08-20 07:52:49 -04:00
|
|
|
|
|
|
|
type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
|
|
|
|
|
|
|
|
// ############################################################################
|
2019-08-15 05:53:26 -04:00
|
|
|
|
|
|
|
export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
|
|
|
|
|
2019-08-20 07:52:49 -04:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
export type MActorFollowFollowingHost = MActorFollow &
|
|
|
|
Use<'ActorFollowing', MActorUsername & MActorHost>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// With actors or actors default
|
|
|
|
|
2019-08-15 05:53:26 -04:00
|
|
|
export type MActorFollowActors = MActorFollow &
|
2019-08-20 07:52:49 -04:00
|
|
|
Use<'ActorFollower', MActor> &
|
|
|
|
Use<'ActorFollowing', MActor>
|
2019-08-15 05:53:26 -04:00
|
|
|
|
|
|
|
export type MActorFollowActorsDefault = MActorFollow &
|
2019-08-20 07:52:49 -04:00
|
|
|
Use<'ActorFollower', MActorDefault> &
|
|
|
|
Use<'ActorFollowing', MActorDefault>
|
2019-08-15 05:53:26 -04:00
|
|
|
|
|
|
|
export type MActorFollowFull = MActorFollow &
|
2019-08-30 10:50:12 -04:00
|
|
|
Use<'ActorFollower', MActorDefaultAccountChannel> &
|
|
|
|
Use<'ActorFollowing', MActorDefaultAccountChannel>
|
2019-08-15 05:53:26 -04:00
|
|
|
|
2019-08-20 07:52:49 -04:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// For subscriptions
|
|
|
|
|
2019-08-20 13:05:31 -04:00
|
|
|
type SubscriptionFollowing = MActorDefault &
|
|
|
|
PickWith<ActorModel, 'VideoChannel', MChannelDefault>
|
|
|
|
|
2019-08-20 07:52:49 -04:00
|
|
|
export type MActorFollowActorsDefaultSubscription = MActorFollow &
|
|
|
|
Use<'ActorFollower', MActorDefault> &
|
2019-08-20 13:05:31 -04:00
|
|
|
Use<'ActorFollowing', SubscriptionFollowing>
|
2019-08-20 07:52:49 -04:00
|
|
|
|
2019-08-15 05:53:26 -04:00
|
|
|
export type MActorFollowSubscriptions = MActorFollow &
|
2019-08-20 07:52:49 -04:00
|
|
|
Use<'ActorFollowing', MActorChannelAccountActor>
|
2019-08-20 13:05:31 -04:00
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Format for API or AP object
|
|
|
|
|
|
|
|
export type MActorFollowFormattable = Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
|
|
|
|
Use<'ActorFollower', MActorFormattable> &
|
|
|
|
Use<'ActorFollowing', MActorFormattable>
|