diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-31 16:56:52 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-03 08:31:02 +0100 |
commit | a15871560f80e07386c1dabb8370cd2664ecfd1f (patch) | |
tree | 44440e140c9e43b0d7f97ade777a76e649e0553d /server/typings/models/account | |
parent | a22046d166805222ca76060e471b6cb3d419a32d (diff) | |
download | PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.tar.gz PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.tar.zst PeerTube-a15871560f80e07386c1dabb8370cd2664ecfd1f.zip |
Move to eslintcontain
Diffstat (limited to 'server/typings/models/account')
-rw-r--r-- | server/typings/models/account/account-blocklist.ts | 6 | ||||
-rw-r--r-- | server/typings/models/account/account.ts | 42 | ||||
-rw-r--r-- | server/typings/models/account/actor-follow.ts | 24 | ||||
-rw-r--r-- | server/typings/models/account/actor.ts | 54 | ||||
-rw-r--r-- | server/typings/models/account/avatar.ts | 3 |
5 files changed, 86 insertions, 43 deletions
diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts index c9cb55332..0d8bf11bd 100644 --- a/server/typings/models/account/account-blocklist.ts +++ b/server/typings/models/account/account-blocklist.ts | |||
@@ -12,7 +12,8 @@ export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'Block | |||
12 | 12 | ||
13 | export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> | 13 | export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> |
14 | 14 | ||
15 | export type MAccountBlocklistAccounts = MAccountBlocklist & | 15 | export type MAccountBlocklistAccounts = |
16 | MAccountBlocklist & | ||
16 | Use<'ByAccount', MAccountDefault> & | 17 | Use<'ByAccount', MAccountDefault> & |
17 | Use<'BlockedAccount', MAccountDefault> | 18 | Use<'BlockedAccount', MAccountDefault> |
18 | 19 | ||
@@ -20,6 +21,7 @@ export type MAccountBlocklistAccounts = MAccountBlocklist & | |||
20 | 21 | ||
21 | // Format for API or AP object | 22 | // Format for API or AP object |
22 | 23 | ||
23 | export type MAccountBlocklistFormattable = Pick<MAccountBlocklist, 'createdAt'> & | 24 | export type MAccountBlocklistFormattable = |
25 | Pick<MAccountBlocklist, 'createdAt'> & | ||
24 | Use<'ByAccount', MAccountFormattable> & | 26 | Use<'ByAccount', MAccountFormattable> & |
25 | Use<'BlockedAccount', MAccountFormattable> | 27 | Use<'BlockedAccount', MAccountFormattable> |
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index adb1f3689..7b826ee04 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts | |||
@@ -21,7 +21,8 @@ type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M> | |||
21 | 21 | ||
22 | // ############################################################################ | 22 | // ############################################################################ |
23 | 23 | ||
24 | export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' | | 24 | export type MAccount = |
25 | Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' | | ||
25 | 'VideoComments' | 'BlockedAccounts'> | 26 | 'VideoComments' | 'BlockedAccounts'> |
26 | 27 | ||
27 | // ############################################################################ | 28 | // ############################################################################ |
@@ -34,62 +35,75 @@ export type MAccountUserId = Pick<MAccount, 'userId'> | |||
34 | export type MAccountUrl = Use<'Actor', MActorUrl> | 35 | export type MAccountUrl = Use<'Actor', MActorUrl> |
35 | export type MAccountAudience = Use<'Actor', MActorAudience> | 36 | export type MAccountAudience = Use<'Actor', MActorAudience> |
36 | 37 | ||
37 | export type MAccountIdActor = MAccountId & | 38 | export type MAccountIdActor = |
39 | MAccountId & | ||
38 | Use<'Actor', MActor> | 40 | Use<'Actor', MActor> |
39 | 41 | ||
40 | export type MAccountIdActorId = MAccountId & | 42 | export type MAccountIdActorId = |
43 | MAccountId & | ||
41 | Use<'Actor', MActorId> | 44 | Use<'Actor', MActorId> |
42 | 45 | ||
43 | // ############################################################################ | 46 | // ############################################################################ |
44 | 47 | ||
45 | // Default scope | 48 | // Default scope |
46 | export type MAccountDefault = MAccount & | 49 | export type MAccountDefault = |
50 | MAccount & | ||
47 | Use<'Actor', MActorDefault> | 51 | Use<'Actor', MActorDefault> |
48 | 52 | ||
49 | // Default with default association scopes | 53 | // Default with default association scopes |
50 | export type MAccountDefaultChannelDefault = MAccount & | 54 | export type MAccountDefaultChannelDefault = |
55 | MAccount & | ||
51 | Use<'Actor', MActorDefault> & | 56 | Use<'Actor', MActorDefault> & |
52 | Use<'VideoChannels', MChannelDefault[]> | 57 | Use<'VideoChannels', MChannelDefault[]> |
53 | 58 | ||
54 | // We don't need some actors attributes | 59 | // We don't need some actors attributes |
55 | export type MAccountLight = MAccount & | 60 | export type MAccountLight = |
61 | MAccount & | ||
56 | Use<'Actor', MActorDefaultLight> | 62 | Use<'Actor', MActorDefaultLight> |
57 | 63 | ||
58 | // ############################################################################ | 64 | // ############################################################################ |
59 | 65 | ||
60 | // Full actor | 66 | // Full actor |
61 | export type MAccountActor = MAccount & | 67 | export type MAccountActor = |
68 | MAccount & | ||
62 | Use<'Actor', MActor> | 69 | Use<'Actor', MActor> |
63 | 70 | ||
64 | // Full actor with server | 71 | // Full actor with server |
65 | export type MAccountServer = MAccount & | 72 | export type MAccountServer = |
73 | MAccount & | ||
66 | Use<'Actor', MActorServer> | 74 | Use<'Actor', MActorServer> |
67 | 75 | ||
68 | // ############################################################################ | 76 | // ############################################################################ |
69 | 77 | ||
70 | // For API | 78 | // For API |
71 | 79 | ||
72 | export type MAccountSummary = FunctionProperties<MAccount> & | 80 | export type MAccountSummary = |
81 | FunctionProperties<MAccount> & | ||
73 | Pick<MAccount, 'id' | 'name'> & | 82 | Pick<MAccount, 'id' | 'name'> & |
74 | Use<'Actor', MActorSummary> | 83 | Use<'Actor', MActorSummary> |
75 | 84 | ||
76 | export type MAccountSummaryBlocks = MAccountSummary & | 85 | export type MAccountSummaryBlocks = |
86 | MAccountSummary & | ||
77 | Use<'BlockedAccounts', MAccountBlocklistId[]> | 87 | Use<'BlockedAccounts', MAccountBlocklistId[]> |
78 | 88 | ||
79 | export type MAccountAPI = MAccount & | 89 | export type MAccountAPI = |
90 | MAccount & | ||
80 | Use<'Actor', MActorAPI> | 91 | Use<'Actor', MActorAPI> |
81 | 92 | ||
82 | // ############################################################################ | 93 | // ############################################################################ |
83 | 94 | ||
84 | // Format for API or AP object | 95 | // Format for API or AP object |
85 | 96 | ||
86 | export type MAccountSummaryFormattable = FunctionProperties<MAccount> & | 97 | export type MAccountSummaryFormattable = |
98 | FunctionProperties<MAccount> & | ||
87 | Pick<MAccount, 'id' | 'name'> & | 99 | Pick<MAccount, 'id' | 'name'> & |
88 | Use<'Actor', MActorSummaryFormattable> | 100 | Use<'Actor', MActorSummaryFormattable> |
89 | 101 | ||
90 | export type MAccountFormattable = FunctionProperties<MAccount> & | 102 | export type MAccountFormattable = |
103 | FunctionProperties<MAccount> & | ||
91 | Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & | 104 | Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & |
92 | Use<'Actor', MActorFormattable> | 105 | Use<'Actor', MActorFormattable> |
93 | 106 | ||
94 | export type MAccountAP = Pick<MAccount, 'name' | 'description'> & | 107 | export type MAccountAP = |
108 | Pick<MAccount, 'name' | 'description'> & | ||
95 | Use<'Actor', MActorAP> | 109 | Use<'Actor', MActorAP> |
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts index f44157eba..5d0c03c8d 100644 --- a/server/typings/models/account/actor-follow.ts +++ b/server/typings/models/account/actor-follow.ts | |||
@@ -20,22 +20,26 @@ export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollow | |||
20 | 20 | ||
21 | // ############################################################################ | 21 | // ############################################################################ |
22 | 22 | ||
23 | export type MActorFollowFollowingHost = MActorFollow & | 23 | export type MActorFollowFollowingHost = |
24 | MActorFollow & | ||
24 | Use<'ActorFollowing', MActorUsername & MActorHost> | 25 | Use<'ActorFollowing', MActorUsername & MActorHost> |
25 | 26 | ||
26 | // ############################################################################ | 27 | // ############################################################################ |
27 | 28 | ||
28 | // With actors or actors default | 29 | // With actors or actors default |
29 | 30 | ||
30 | export type MActorFollowActors = MActorFollow & | 31 | export type MActorFollowActors = |
32 | MActorFollow & | ||
31 | Use<'ActorFollower', MActor> & | 33 | Use<'ActorFollower', MActor> & |
32 | Use<'ActorFollowing', MActor> | 34 | Use<'ActorFollowing', MActor> |
33 | 35 | ||
34 | export type MActorFollowActorsDefault = MActorFollow & | 36 | export type MActorFollowActorsDefault = |
37 | MActorFollow & | ||
35 | Use<'ActorFollower', MActorDefault> & | 38 | Use<'ActorFollower', MActorDefault> & |
36 | Use<'ActorFollowing', MActorDefault> | 39 | Use<'ActorFollowing', MActorDefault> |
37 | 40 | ||
38 | export type MActorFollowFull = MActorFollow & | 41 | export type MActorFollowFull = |
42 | MActorFollow & | ||
39 | Use<'ActorFollower', MActorDefaultAccountChannel> & | 43 | Use<'ActorFollower', MActorDefaultAccountChannel> & |
40 | Use<'ActorFollowing', MActorDefaultAccountChannel> | 44 | Use<'ActorFollowing', MActorDefaultAccountChannel> |
41 | 45 | ||
@@ -43,20 +47,24 @@ export type MActorFollowFull = MActorFollow & | |||
43 | 47 | ||
44 | // For subscriptions | 48 | // For subscriptions |
45 | 49 | ||
46 | type SubscriptionFollowing = MActorDefault & | 50 | type SubscriptionFollowing = |
51 | MActorDefault & | ||
47 | PickWith<ActorModel, 'VideoChannel', MChannelDefault> | 52 | PickWith<ActorModel, 'VideoChannel', MChannelDefault> |
48 | 53 | ||
49 | export type MActorFollowActorsDefaultSubscription = MActorFollow & | 54 | export type MActorFollowActorsDefaultSubscription = |
55 | MActorFollow & | ||
50 | Use<'ActorFollower', MActorDefault> & | 56 | Use<'ActorFollower', MActorDefault> & |
51 | Use<'ActorFollowing', SubscriptionFollowing> | 57 | Use<'ActorFollowing', SubscriptionFollowing> |
52 | 58 | ||
53 | export type MActorFollowSubscriptions = MActorFollow & | 59 | export type MActorFollowSubscriptions = |
60 | MActorFollow & | ||
54 | Use<'ActorFollowing', MActorChannelAccountActor> | 61 | Use<'ActorFollowing', MActorChannelAccountActor> |
55 | 62 | ||
56 | // ############################################################################ | 63 | // ############################################################################ |
57 | 64 | ||
58 | // Format for API or AP object | 65 | // Format for API or AP object |
59 | 66 | ||
60 | export type MActorFollowFormattable = Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> & | 67 | export type MActorFollowFormattable = |
68 | Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> & | ||
61 | Use<'ActorFollower', MActorFormattable> & | 69 | Use<'ActorFollower', MActorFormattable> & |
62 | Use<'ActorFollowing', MActorFormattable> | 70 | Use<'ActorFollowing', MActorFormattable> |
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index ee4ece755..1160e84cb 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts | |||
@@ -31,18 +31,23 @@ export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> | |||
31 | export type MActorHost = Use<'Server', MServerHost> | 31 | export type MActorHost = Use<'Server', MServerHost> |
32 | export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed> | 32 | export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed> |
33 | 33 | ||
34 | export type MActorDefaultLight = MActorLight & | 34 | export type MActorDefaultLight = |
35 | MActorLight & | ||
35 | Use<'Server', MServerHost> & | 36 | Use<'Server', MServerHost> & |
36 | Use<'Avatar', MAvatar> | 37 | Use<'Avatar', MAvatar> |
37 | 38 | ||
38 | export type MActorAccountId = MActor & | 39 | export type MActorAccountId = |
40 | MActor & | ||
39 | Use<'Account', MAccountId> | 41 | Use<'Account', MAccountId> |
40 | export type MActorAccountIdActor = MActor & | 42 | export type MActorAccountIdActor = |
43 | MActor & | ||
41 | Use<'Account', MAccountIdActor> | 44 | Use<'Account', MAccountIdActor> |
42 | 45 | ||
43 | export type MActorChannelId = MActor & | 46 | export type MActorChannelId = |
47 | MActor & | ||
44 | Use<'VideoChannel', MChannelId> | 48 | Use<'VideoChannel', MChannelId> |
45 | export type MActorChannelIdActor = MActor & | 49 | export type MActorChannelIdActor = |
50 | MActor & | ||
46 | Use<'VideoChannel', MChannelIdActor> | 51 | Use<'VideoChannel', MChannelIdActor> |
47 | 52 | ||
48 | export type MActorAccountChannelId = MActorAccountId & MActorChannelId | 53 | export type MActorAccountChannelId = MActorAccountId & MActorChannelId |
@@ -52,38 +57,45 @@ export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelId | |||
52 | 57 | ||
53 | // Include raw account/channel/server | 58 | // Include raw account/channel/server |
54 | 59 | ||
55 | export type MActorAccount = MActor & | 60 | export type MActorAccount = |
61 | MActor & | ||
56 | Use<'Account', MAccount> | 62 | Use<'Account', MAccount> |
57 | 63 | ||
58 | export type MActorChannel = MActor & | 64 | export type MActorChannel = |
65 | MActor & | ||
59 | Use<'VideoChannel', MChannel> | 66 | Use<'VideoChannel', MChannel> |
60 | 67 | ||
61 | export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel | 68 | export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel |
62 | 69 | ||
63 | export type MActorServer = MActor & | 70 | export type MActorServer = |
71 | MActor & | ||
64 | Use<'Server', MServer> | 72 | Use<'Server', MServer> |
65 | 73 | ||
66 | // ############################################################################ | 74 | // ############################################################################ |
67 | 75 | ||
68 | // Complex actor associations | 76 | // Complex actor associations |
69 | 77 | ||
70 | export type MActorDefault = MActor & | 78 | export type MActorDefault = |
79 | MActor & | ||
71 | Use<'Server', MServer> & | 80 | Use<'Server', MServer> & |
72 | Use<'Avatar', MAvatar> | 81 | Use<'Avatar', MAvatar> |
73 | 82 | ||
74 | // Actor with channel that is associated to an account and its actor | 83 | // Actor with channel that is associated to an account and its actor |
75 | // Actor -> VideoChannel -> Account -> Actor | 84 | // Actor -> VideoChannel -> Account -> Actor |
76 | export type MActorChannelAccountActor = MActor & | 85 | export type MActorChannelAccountActor = |
86 | MActor & | ||
77 | Use<'VideoChannel', MChannelAccountActor> | 87 | Use<'VideoChannel', MChannelAccountActor> |
78 | 88 | ||
79 | export type MActorFull = MActor & | 89 | export type MActorFull = |
90 | MActor & | ||
80 | Use<'Server', MServer> & | 91 | Use<'Server', MServer> & |
81 | Use<'Avatar', MAvatar> & | 92 | Use<'Avatar', MAvatar> & |
82 | Use<'Account', MAccount> & | 93 | Use<'Account', MAccount> & |
83 | Use<'VideoChannel', MChannelAccountActor> | 94 | Use<'VideoChannel', MChannelAccountActor> |
84 | 95 | ||
85 | // Same than ActorFull, but the account and the channel have their actor | 96 | // Same than ActorFull, but the account and the channel have their actor |
86 | export type MActorFullActor = MActor & | 97 | export type MActorFullActor = |
98 | MActor & | ||
87 | Use<'Server', MServer> & | 99 | Use<'Server', MServer> & |
88 | Use<'Avatar', MAvatar> & | 100 | Use<'Avatar', MAvatar> & |
89 | Use<'Account', MAccountDefault> & | 101 | Use<'Account', MAccountDefault> & |
@@ -93,29 +105,35 @@ export type MActorFullActor = MActor & | |||
93 | 105 | ||
94 | // API | 106 | // API |
95 | 107 | ||
96 | export type MActorSummary = FunctionProperties<MActor> & | 108 | export type MActorSummary = |
109 | FunctionProperties<MActor> & | ||
97 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | 110 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & |
98 | Use<'Server', MServerHost> & | 111 | Use<'Server', MServerHost> & |
99 | Use<'Avatar', MAvatar> | 112 | Use<'Avatar', MAvatar> |
100 | 113 | ||
101 | export type MActorSummaryBlocks = MActorSummary & | 114 | export type MActorSummaryBlocks = |
115 | MActorSummary & | ||
102 | Use<'Server', MServerHostBlocks> | 116 | Use<'Server', MServerHostBlocks> |
103 | 117 | ||
104 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | | 118 | export type MActorAPI = |
119 | Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | | ||
105 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> | 120 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> |
106 | 121 | ||
107 | // ############################################################################ | 122 | // ############################################################################ |
108 | 123 | ||
109 | // Format for API or AP object | 124 | // Format for API or AP object |
110 | 125 | ||
111 | export type MActorSummaryFormattable = FunctionProperties<MActor> & | 126 | export type MActorSummaryFormattable = |
127 | FunctionProperties<MActor> & | ||
112 | Pick<MActor, 'url' | 'preferredUsername'> & | 128 | Pick<MActor, 'url' | 'preferredUsername'> & |
113 | Use<'Server', MServerHost> & | 129 | Use<'Server', MServerHost> & |
114 | Use<'Avatar', MAvatarFormattable> | 130 | Use<'Avatar', MAvatarFormattable> |
115 | 131 | ||
116 | export type MActorFormattable = MActorSummaryFormattable & | 132 | export type MActorFormattable = |
133 | MActorSummaryFormattable & | ||
117 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & | 134 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & |
118 | Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> | 135 | Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> |
119 | 136 | ||
120 | export type MActorAP = MActor & | 137 | export type MActorAP = |
138 | MActor & | ||
121 | Use<'Avatar', MAvatar> | 139 | Use<'Avatar', MAvatar> |
diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts index 8af6cc787..21b47180f 100644 --- a/server/typings/models/account/avatar.ts +++ b/server/typings/models/account/avatar.ts | |||
@@ -7,5 +7,6 @@ export type MAvatar = AvatarModel | |||
7 | 7 | ||
8 | // Format for API or AP object | 8 | // Format for API or AP object |
9 | 9 | ||
10 | export type MAvatarFormattable = FunctionProperties<MAvatar> & | 10 | export type MAvatarFormattable = |
11 | FunctionProperties<MAvatar> & | ||
11 | Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'> | 12 | Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'> |