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

71 lines
2.1 KiB
TypeScript
Raw Normal View History

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,
MActorChannelAccountActor,
MActorDefault,
MActorDefaultAccountChannel,
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'
import { MChannelDefault } from '../video/video-channels'
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
// ############################################################################
2020-01-31 16:56:52 +01:00
export type MActorFollowFollowingHost =
MActorFollow &
2019-08-20 13:52:49 +02:00
Use<'ActorFollowing', MActorUsername & MActorHost>
// ############################################################################
// With actors or actors default
2020-01-31 16:56:52 +01: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
2020-01-31 16:56:52 +01: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
2020-01-31 16:56:52 +01:00
export type MActorFollowFull =
MActorFollow &
Use<'ActorFollower', MActorDefaultAccountChannel> &
Use<'ActorFollowing', MActorDefaultAccountChannel>
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
// ############################################################################
// For subscriptions
2020-01-31 16:56:52 +01:00
type SubscriptionFollowing =
MActorDefault &
2019-08-20 19:05:31 +02:00
PickWith<ActorModel, 'VideoChannel', MChannelDefault>
2020-01-31 16:56:52 +01:00
export type MActorFollowActorsDefaultSubscription =
MActorFollow &
2019-08-20 13:52:49 +02:00
Use<'ActorFollower', MActorDefault> &
2019-08-20 19:05:31 +02:00
Use<'ActorFollowing', SubscriptionFollowing>
2019-08-20 13:52:49 +02:00
2020-01-31 16:56:52 +01: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
2020-01-31 16:56:52 +01:00
export type MActorFollowFormattable =
Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
2019-08-20 19:05:31 +02:00
Use<'ActorFollower', MActorFormattable> &
Use<'ActorFollowing', MActorFormattable>