diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-20 13:52:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-20 14:53:42 +0200 |
commit | 0283eaac2a8e73006c66df3cf5bb9012e37450e5 (patch) | |
tree | 1fb73aeef57f984a77f47828ade23c6365ce8eb0 /server/typings/models/account/actor-follow.ts | |
parent | 96ca24f00e5ae5471dee9ee596489fe50af2b46f (diff) | |
download | PeerTube-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.ts | 56 |
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 @@ | |||
1 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 1 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
2 | import { MActor, MActorAccountChannel, MActorChannel, MActorChannelAccount, MActorDefault, MActorHost, MActorUsername } from './actor' | 2 | import { |
3 | MActor, | ||
4 | MActorAccount, | ||
5 | MActorAccountChannel, | ||
6 | MActorChannel, | ||
7 | MActorChannelAccountActor, | ||
8 | MActorDefault, | ||
9 | MActorHost, | ||
10 | MActorUsername | ||
11 | } from './actor' | ||
3 | import { PickWith } from '../../utils' | 12 | import { PickWith } from '../../utils' |
13 | import { ActorModel } from '@server/models/activitypub/actor' | ||
14 | |||
15 | type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M> | ||
16 | |||
17 | // ############################################################################ | ||
4 | 18 | ||
5 | export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> | 19 | export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'> |
6 | 20 | ||
21 | // ############################################################################ | ||
22 | |||
23 | export type MActorFollowFollowingHost = MActorFollow & | ||
24 | Use<'ActorFollowing', MActorUsername & MActorHost> | ||
25 | |||
26 | // ############################################################################ | ||
27 | |||
28 | // With actors or actors default | ||
29 | |||
7 | export type MActorFollowActors = MActorFollow & | 30 | export type MActorFollowActors = MActorFollow & |
8 | PickWith<ActorFollowModel, 'ActorFollower', MActor> & | 31 | Use<'ActorFollower', MActor> & |
9 | PickWith<ActorFollowModel, 'ActorFollowing', MActor> | 32 | Use<'ActorFollowing', MActor> |
10 | 33 | ||
11 | export type MActorFollowActorsDefault = MActorFollow & | 34 | export type MActorFollowActorsDefault = MActorFollow & |
12 | PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> & | 35 | Use<'ActorFollower', MActorDefault> & |
13 | PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault> | 36 | Use<'ActorFollowing', MActorDefault> |
14 | |||
15 | export type MActorFollowActorsDefaultSubscription = MActorFollow & | ||
16 | PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> & | ||
17 | PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault & MActorChannel> | ||
18 | 37 | ||
19 | export type MActorFollowFull = MActorFollow & | 38 | export type MActorFollowFull = MActorFollow & |
20 | PickWith<ActorFollowModel, 'ActorFollower', MActorAccountChannel> & | 39 | Use<'ActorFollower', MActorAccountChannel> & |
21 | PickWith<ActorFollowModel, 'ActorFollowing', MActorAccountChannel> | 40 | Use<'ActorFollowing', MActorAccountChannel> |
22 | 41 | ||
23 | export type MActorFollowFollowingHost = MActorFollow & | 42 | // ############################################################################ |
24 | PickWith<ActorFollowModel, 'ActorFollowing', MActorUsername & MActorHost> | 43 | |
44 | // For subscriptions | ||
45 | |||
46 | export type MActorFollowActorsDefaultSubscription = MActorFollow & | ||
47 | Use<'ActorFollower', MActorDefault> & | ||
48 | Use<'ActorFollowing', MActorDefault & MActorChannel> | ||
49 | |||
50 | export type MActorFollowFollowingFullFollowerAccount = MActorFollow & | ||
51 | Use<'ActorFollower', MActorAccount> & | ||
52 | Use<'ActorFollowing', MActorAccountChannel> | ||
25 | 53 | ||
26 | export type MActorFollowSubscriptions = MActorFollow & | 54 | export type MActorFollowSubscriptions = MActorFollow & |
27 | PickWith<ActorFollowModel, 'ActorFollowing', MActorChannelAccount> | 55 | Use<'ActorFollowing', MActorChannelAccountActor> |