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