PeerTube/server/typings/models/account/actor-follow.ts

64 lines
2.1 KiB
TypeScript
Raw Normal View History

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