diff options
Diffstat (limited to 'server/typings/models/account')
-rw-r--r-- | server/typings/models/account/account-blocklist.ts | 10 | ||||
-rw-r--r-- | server/typings/models/account/account.ts | 21 | ||||
-rw-r--r-- | server/typings/models/account/actor-follow.ts | 16 | ||||
-rw-r--r-- | server/typings/models/account/actor.ts | 23 | ||||
-rw-r--r-- | server/typings/models/account/avatar.ts | 8 |
5 files changed, 68 insertions, 10 deletions
diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts index d20d97aa8..c9cb55332 100644 --- a/server/typings/models/account/account-blocklist.ts +++ b/server/typings/models/account/account-blocklist.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' | 1 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccountDefault } from './account' | 3 | import { MAccountDefault, MAccountFormattable } from './account' |
4 | 4 | ||
5 | type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M> | 5 | type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M> |
6 | 6 | ||
@@ -15,3 +15,11 @@ export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'> | |||
15 | export type MAccountBlocklistAccounts = MAccountBlocklist & | 15 | export type MAccountBlocklistAccounts = MAccountBlocklist & |
16 | Use<'ByAccount', MAccountDefault> & | 16 | Use<'ByAccount', MAccountDefault> & |
17 | Use<'BlockedAccount', MAccountDefault> | 17 | Use<'BlockedAccount', MAccountDefault> |
18 | |||
19 | // ############################################################################ | ||
20 | |||
21 | // Format for API or AP object | ||
22 | |||
23 | export type MAccountBlocklistFormattable = Pick<MAccountBlocklist, 'createdAt'> & | ||
24 | Use<'ByAccount', MAccountFormattable> & | ||
25 | Use<'BlockedAccount', MAccountFormattable> | ||
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index 9a8784e6b..33940517e 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts | |||
@@ -9,9 +9,11 @@ import { | |||
9 | MActorId, | 9 | MActorId, |
10 | MActorServer, | 10 | MActorServer, |
11 | MActorSummary, | 11 | MActorSummary, |
12 | MActorUrl | 12 | MActorSummaryFormattable, |
13 | MActorUrl, | ||
14 | MActorFormattable | ||
13 | } from './actor' | 15 | } from './actor' |
14 | import { PickWith } from '../../utils' | 16 | import { FunctionProperties, PickWith } from '../../utils' |
15 | import { MAccountBlocklistId } from './account-blocklist' | 17 | import { MAccountBlocklistId } from './account-blocklist' |
16 | import { MChannelDefault } from '@server/typings/models' | 18 | import { MChannelDefault } from '@server/typings/models' |
17 | 19 | ||
@@ -67,7 +69,8 @@ export type MAccountServer = MAccount & | |||
67 | 69 | ||
68 | // For API | 70 | // For API |
69 | 71 | ||
70 | export type MAccountSummary = Pick<MAccount, 'id' | 'name'> & | 72 | export type MAccountSummary = FunctionProperties<MAccount> & |
73 | Pick<MAccount, 'id' | 'name'> & | ||
71 | Use<'Actor', MActorSummary> | 74 | Use<'Actor', MActorSummary> |
72 | 75 | ||
73 | export type MAccountSummaryBlocks = MAccountSummary & | 76 | export type MAccountSummaryBlocks = MAccountSummary & |
@@ -75,3 +78,15 @@ export type MAccountSummaryBlocks = MAccountSummary & | |||
75 | 78 | ||
76 | export type MAccountAPI = MAccount & | 79 | export type MAccountAPI = MAccount & |
77 | Use<'Actor', MActorAPI> | 80 | Use<'Actor', MActorAPI> |
81 | |||
82 | // ############################################################################ | ||
83 | |||
84 | // Format for API or AP object | ||
85 | |||
86 | export type MAccountSummaryFormattable = FunctionProperties<MAccount> & | ||
87 | Pick<MAccount, 'id' | 'name'> & | ||
88 | Use<'Actor', MActorSummaryFormattable> | ||
89 | |||
90 | export type MAccountFormattable = FunctionProperties<MAccount> & | ||
91 | Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & | ||
92 | Use<'Actor', MActorFormattable> | ||
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts index 87050ac63..17a47b8df 100644 --- a/server/typings/models/account/actor-follow.ts +++ b/server/typings/models/account/actor-follow.ts | |||
@@ -3,14 +3,15 @@ import { | |||
3 | MActor, | 3 | MActor, |
4 | MActorAccount, | 4 | MActorAccount, |
5 | MActorAccountChannel, | 5 | MActorAccountChannel, |
6 | MActorChannel, | ||
7 | MActorChannelAccountActor, | 6 | MActorChannelAccountActor, |
8 | MActorDefault, | 7 | MActorDefault, |
8 | MActorFormattable, | ||
9 | MActorHost, | 9 | MActorHost, |
10 | MActorUsername | 10 | MActorUsername |
11 | } from './actor' | 11 | } from './actor' |
12 | import { PickWith } from '../../utils' | 12 | import { PickWith } from '../../utils' |
13 | import { ActorModel } from '@server/models/activitypub/actor' | 13 | import { ActorModel } from '@server/models/activitypub/actor' |
14 | import { MChannelDefault } from '@server/typings/models' | ||
14 | 15 | ||
15 | type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M> | 16 | type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M> |
16 | 17 | ||
@@ -43,9 +44,12 @@ export type MActorFollowFull = MActorFollow & | |||
43 | 44 | ||
44 | // For subscriptions | 45 | // For subscriptions |
45 | 46 | ||
47 | type SubscriptionFollowing = MActorDefault & | ||
48 | PickWith<ActorModel, 'VideoChannel', MChannelDefault> | ||
49 | |||
46 | export type MActorFollowActorsDefaultSubscription = MActorFollow & | 50 | export type MActorFollowActorsDefaultSubscription = MActorFollow & |
47 | Use<'ActorFollower', MActorDefault> & | 51 | Use<'ActorFollower', MActorDefault> & |
48 | Use<'ActorFollowing', MActorDefault & MActorChannel> | 52 | Use<'ActorFollowing', SubscriptionFollowing> |
49 | 53 | ||
50 | export type MActorFollowFollowingFullFollowerAccount = MActorFollow & | 54 | export type MActorFollowFollowingFullFollowerAccount = MActorFollow & |
51 | Use<'ActorFollower', MActorAccount> & | 55 | Use<'ActorFollower', MActorAccount> & |
@@ -53,3 +57,11 @@ export type MActorFollowFollowingFullFollowerAccount = MActorFollow & | |||
53 | 57 | ||
54 | export type MActorFollowSubscriptions = MActorFollow & | 58 | export type MActorFollowSubscriptions = MActorFollow & |
55 | Use<'ActorFollowing', MActorChannelAccountActor> | 59 | Use<'ActorFollowing', MActorChannelAccountActor> |
60 | |||
61 | // ############################################################################ | ||
62 | |||
63 | // Format for API or AP object | ||
64 | |||
65 | export type MActorFollowFormattable = Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> & | ||
66 | Use<'ActorFollower', MActorFormattable> & | ||
67 | Use<'ActorFollowing', MActorFormattable> | ||
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index 7d99a433b..14ab2cd5b 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { ActorModel } from '../../../models/activitypub/actor' | 1 | import { ActorModel } from '../../../models/activitypub/actor' |
2 | import { PickWith } from '../../utils' | 2 | import { FunctionProperties, PickWith } from '../../utils' |
3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' | 3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' |
4 | import { MServer, MServerHost, MServerHostBlocks } from '../server' | 4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' |
5 | import { MAvatar } from './avatar' | 5 | import { MAvatar, MAvatarFormattable } from './avatar' |
6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' | 6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' |
7 | 7 | ||
8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> | 8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> |
@@ -29,6 +29,7 @@ export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> | |||
29 | // Some association attributes | 29 | // Some association attributes |
30 | 30 | ||
31 | export type MActorHost = Use<'Server', MServerHost> | 31 | export type MActorHost = Use<'Server', MServerHost> |
32 | export type MActorRedundancyAllowed = Use<'Server', MServerRedundancyAllowed> | ||
32 | 33 | ||
33 | export type MActorDefaultLight = MActorLight & | 34 | export type MActorDefaultLight = MActorLight & |
34 | Use<'Server', MServerHost> & | 35 | Use<'Server', MServerHost> & |
@@ -92,7 +93,8 @@ export type MActorFullActor = MActor & | |||
92 | 93 | ||
93 | // API | 94 | // API |
94 | 95 | ||
95 | export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | 96 | export type MActorSummary = FunctionProperties<MActor> & |
97 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | ||
96 | Use<'Server', MServerHost> & | 98 | Use<'Server', MServerHost> & |
97 | Use<'Avatar', MAvatar> | 99 | Use<'Avatar', MAvatar> |
98 | 100 | ||
@@ -101,3 +103,16 @@ export type MActorSummaryBlocks = MActorSummary & | |||
101 | 103 | ||
102 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | | 104 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | |
103 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> | 105 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> |
106 | |||
107 | // ############################################################################ | ||
108 | |||
109 | // Format for API or AP object | ||
110 | |||
111 | export type MActorSummaryFormattable = FunctionProperties<MActor> & | ||
112 | Pick<MActor, 'url' | 'preferredUsername'> & | ||
113 | Use<'Server', MServerHost> & | ||
114 | Use<'Avatar', MAvatarFormattable> | ||
115 | |||
116 | export type MActorFormattable = MActorSummaryFormattable & | ||
117 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & | ||
118 | Use<'Server', MServer> | ||
diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts index 257c48bfc..8af6cc787 100644 --- a/server/typings/models/account/avatar.ts +++ b/server/typings/models/account/avatar.ts | |||
@@ -1,3 +1,11 @@ | |||
1 | import { AvatarModel } from '../../../models/avatar/avatar' | 1 | import { AvatarModel } from '../../../models/avatar/avatar' |
2 | import { FunctionProperties } from '@server/typings/utils' | ||
2 | 3 | ||
3 | export type MAvatar = AvatarModel | 4 | export type MAvatar = AvatarModel |
5 | |||
6 | // ############################################################################ | ||
7 | |||
8 | // Format for API or AP object | ||
9 | |||
10 | export type MAvatarFormattable = FunctionProperties<MAvatar> & | ||
11 | Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'> | ||