aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types/models/account/actor-follow.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/types/models/account/actor-follow.ts')
-rw-r--r--server/types/models/account/actor-follow.ts70
1 files changed, 70 insertions, 0 deletions
diff --git a/server/types/models/account/actor-follow.ts b/server/types/models/account/actor-follow.ts
new file mode 100644
index 000000000..5d0c03c8d
--- /dev/null
+++ b/server/types/models/account/actor-follow.ts
@@ -0,0 +1,70 @@
1import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
2import {
3 MActor,
4 MActorChannelAccountActor,
5 MActorDefault,
6 MActorDefaultAccountChannel,
7 MActorFormattable,
8 MActorHost,
9 MActorUsername
10} from './actor'
11import { PickWith } from '../../utils'
12import { ActorModel } from '@server/models/activitypub/actor'
13import { MChannelDefault } from '../video/video-channels'
14
15type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
16
17// ############################################################################
18
19export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
20
21// ############################################################################
22
23export type MActorFollowFollowingHost =
24 MActorFollow &
25 Use<'ActorFollowing', MActorUsername & MActorHost>
26
27// ############################################################################
28
29// With actors or actors default
30
31export type MActorFollowActors =
32 MActorFollow &
33 Use<'ActorFollower', MActor> &
34 Use<'ActorFollowing', MActor>
35
36export type MActorFollowActorsDefault =
37 MActorFollow &
38 Use<'ActorFollower', MActorDefault> &
39 Use<'ActorFollowing', MActorDefault>
40
41export type MActorFollowFull =
42 MActorFollow &
43 Use<'ActorFollower', MActorDefaultAccountChannel> &
44 Use<'ActorFollowing', MActorDefaultAccountChannel>
45
46// ############################################################################
47
48// For subscriptions
49
50type SubscriptionFollowing =
51 MActorDefault &
52 PickWith<ActorModel, 'VideoChannel', MChannelDefault>
53
54export type MActorFollowActorsDefaultSubscription =
55 MActorFollow &
56 Use<'ActorFollower', MActorDefault> &
57 Use<'ActorFollowing', SubscriptionFollowing>
58
59export type MActorFollowSubscriptions =
60 MActorFollow &
61 Use<'ActorFollowing', MActorChannelAccountActor>
62
63// ############################################################################
64
65// Format for API or AP object
66
67export type MActorFollowFormattable =
68 Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
69 Use<'ActorFollower', MActorFormattable> &
70 Use<'ActorFollowing', MActorFormattable>