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