]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/typings/models/account/actor-follow.ts
Move to eslint
[github/Chocobozzz/PeerTube.git] / server / typings / models / account / actor-follow.ts
1 import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
2 import {
3 MActor,
4 MActorChannelAccountActor,
5 MActorDefault,
6 MActorDefaultAccountChannel,
7 MActorFormattable,
8 MActorHost,
9 MActorUsername
10 } from './actor'
11 import { PickWith } from '../../utils'
12 import { ActorModel } from '@server/models/activitypub/actor'
13 import { MChannelDefault } from '../video/video-channels'
14
15 type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
16
17 // ############################################################################
18
19 export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
20
21 // ############################################################################
22
23 export type MActorFollowFollowingHost =
24 MActorFollow &
25 Use<'ActorFollowing', MActorUsername & MActorHost>
26
27 // ############################################################################
28
29 // With actors or actors default
30
31 export type MActorFollowActors =
32 MActorFollow &
33 Use<'ActorFollower', MActor> &
34 Use<'ActorFollowing', MActor>
35
36 export type MActorFollowActorsDefault =
37 MActorFollow &
38 Use<'ActorFollower', MActorDefault> &
39 Use<'ActorFollowing', MActorDefault>
40
41 export type MActorFollowFull =
42 MActorFollow &
43 Use<'ActorFollower', MActorDefaultAccountChannel> &
44 Use<'ActorFollowing', MActorDefaultAccountChannel>
45
46 // ############################################################################
47
48 // For subscriptions
49
50 type SubscriptionFollowing =
51 MActorDefault &
52 PickWith<ActorModel, 'VideoChannel', MChannelDefault>
53
54 export type MActorFollowActorsDefaultSubscription =
55 MActorFollow &
56 Use<'ActorFollower', MActorDefault> &
57 Use<'ActorFollowing', SubscriptionFollowing>
58
59 export type MActorFollowSubscriptions =
60 MActorFollow &
61 Use<'ActorFollowing', MActorChannelAccountActor>
62
63 // ############################################################################
64
65 // Format for API or AP object
66
67 export type MActorFollowFormattable =
68 Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
69 Use<'ActorFollower', MActorFormattable> &
70 Use<'ActorFollowing', MActorFormattable>