aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/account/actor-follow.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-20 13:52:49 +0200
committerChocobozzz <me@florianbigard.com>2019-08-20 14:53:42 +0200
commit0283eaac2a8e73006c66df3cf5bb9012e37450e5 (patch)
tree1fb73aeef57f984a77f47828ade23c6365ce8eb0 /server/typings/models/account/actor-follow.ts
parent96ca24f00e5ae5471dee9ee596489fe50af2b46f (diff)
downloadPeerTube-0283eaac2a8e73006c66df3cf5bb9012e37450e5.tar.gz
PeerTube-0283eaac2a8e73006c66df3cf5bb9012e37450e5.tar.zst
PeerTube-0283eaac2a8e73006c66df3cf5bb9012e37450e5.zip
Cleanup model types
Diffstat (limited to 'server/typings/models/account/actor-follow.ts')
-rw-r--r--server/typings/models/account/actor-follow.ts56
1 files changed, 42 insertions, 14 deletions
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts
index 96c53d857..87050ac63 100644
--- a/server/typings/models/account/actor-follow.ts
+++ b/server/typings/models/account/actor-follow.ts
@@ -1,27 +1,55 @@
1import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 1import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
2import { MActor, MActorAccountChannel, MActorChannel, MActorChannelAccount, MActorDefault, MActorHost, MActorUsername } from './actor' 2import {
3 MActor,
4 MActorAccount,
5 MActorAccountChannel,
6 MActorChannel,
7 MActorChannelAccountActor,
8 MActorDefault,
9 MActorHost,
10 MActorUsername
11} from './actor'
3import { PickWith } from '../../utils' 12import { PickWith } from '../../utils'
13import { ActorModel } from '@server/models/activitypub/actor'
14
15type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
16
17// ############################################################################
4 18
5export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> 19export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
6 20
21// ############################################################################
22
23export type MActorFollowFollowingHost = MActorFollow &
24 Use<'ActorFollowing', MActorUsername & MActorHost>
25
26// ############################################################################
27
28// With actors or actors default
29
7export type MActorFollowActors = MActorFollow & 30export type MActorFollowActors = MActorFollow &
8 PickWith<ActorFollowModel, 'ActorFollower', MActor> & 31 Use<'ActorFollower', MActor> &
9 PickWith<ActorFollowModel, 'ActorFollowing', MActor> 32 Use<'ActorFollowing', MActor>
10 33
11export type MActorFollowActorsDefault = MActorFollow & 34export type MActorFollowActorsDefault = MActorFollow &
12 PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> & 35 Use<'ActorFollower', MActorDefault> &
13 PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault> 36 Use<'ActorFollowing', MActorDefault>
14
15export type MActorFollowActorsDefaultSubscription = MActorFollow &
16 PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> &
17 PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault & MActorChannel>
18 37
19export type MActorFollowFull = MActorFollow & 38export type MActorFollowFull = MActorFollow &
20 PickWith<ActorFollowModel, 'ActorFollower', MActorAccountChannel> & 39 Use<'ActorFollower', MActorAccountChannel> &
21 PickWith<ActorFollowModel, 'ActorFollowing', MActorAccountChannel> 40 Use<'ActorFollowing', MActorAccountChannel>
22 41
23export type MActorFollowFollowingHost = MActorFollow & 42// ############################################################################
24 PickWith<ActorFollowModel, 'ActorFollowing', MActorUsername & MActorHost> 43
44// For subscriptions
45
46export type MActorFollowActorsDefaultSubscription = MActorFollow &
47 Use<'ActorFollower', MActorDefault> &
48 Use<'ActorFollowing', MActorDefault & MActorChannel>
49
50export type MActorFollowFollowingFullFollowerAccount = MActorFollow &
51 Use<'ActorFollower', MActorAccount> &
52 Use<'ActorFollowing', MActorAccountChannel>
25 53
26export type MActorFollowSubscriptions = MActorFollow & 54export type MActorFollowSubscriptions = MActorFollow &
27 PickWith<ActorFollowModel, 'ActorFollowing', MActorChannelAccount> 55 Use<'ActorFollowing', MActorChannelAccountActor>