aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/account
diff options
context:
space:
mode:
Diffstat (limited to 'server/typings/models/account')
-rw-r--r--server/typings/models/account/account-blocklist.ts11
-rw-r--r--server/typings/models/account/account.ts56
-rw-r--r--server/typings/models/account/actor-follow.ts27
-rw-r--r--server/typings/models/account/actor.ts74
-rw-r--r--server/typings/models/account/avatar.ts3
-rw-r--r--server/typings/models/account/index.d.ts5
6 files changed, 176 insertions, 0 deletions
diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts
new file mode 100644
index 000000000..6d1771de8
--- /dev/null
+++ b/server/typings/models/account/account-blocklist.ts
@@ -0,0 +1,11 @@
1import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
2import { PickWith } from '../../utils'
3import { MAccountDefault } from './account'
4
5export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
6
7export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
8
9export type MAccountBlocklistAccounts = MAccountBlocklist &
10 PickWith<AccountBlocklistModel, 'ByAccount', MAccountDefault> &
11 PickWith<AccountBlocklistModel, 'BlockedAccount', MAccountDefault>
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts
new file mode 100644
index 000000000..f3646d510
--- /dev/null
+++ b/server/typings/models/account/account.ts
@@ -0,0 +1,56 @@
1import { AccountModel } from '../../../models/account/account'
2import {
3 MActor,
4 MActorAccountChannelId,
5 MActorAPI,
6 MActorAudience,
7 MActorDefault,
8 MActorDefaultLight, MActorId,
9 MActorServer,
10 MActorSummary,
11 MActorUrl
12} from './actor'
13import { PickWith } from '../../utils'
14import { MAccountBlocklistId } from './account-blocklist'
15import { MChannelDefault } from '@server/typings/models'
16
17export type MAccountId = Pick<AccountModel, 'id'>
18export type MAccountIdActor = MAccountId &
19 PickWith<AccountModel, 'Actor', MActorAccountChannelId>
20export type MAccountIdActorId = MAccountId &
21 PickWith<AccountModel, 'Actor', MActorId>
22
23export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
24 'VideoComments' | 'BlockedAccounts'>
25
26// Default scope
27export type MAccountDefault = MAccount &
28 PickWith<AccountModel, 'Actor', MActorDefault>
29
30export type MAccountDefaultChannelDefault = MAccountDefault &
31 PickWith<AccountModel, 'VideoChannels', MChannelDefault[]>
32
33export type MAccountLight = MAccount &
34 PickWith<AccountModel, 'Actor', MActorDefaultLight>
35
36export type MAccountUserId = Pick<MAccount, 'userId'>
37
38export type MAccountActor = MAccount &
39 PickWith<AccountModel, 'Actor', MActor>
40export type MAccountServer = MAccountActor &
41 PickWith<AccountModel, 'Actor', MActorServer>
42
43export type MAccountActorDefault = MAccount &
44 PickWith<AccountModel, 'Actor', MActorDefault>
45
46export type MAccountSummary = Pick<MAccount, 'id' | 'name'> &
47 PickWith<AccountModel, 'Actor', MActorSummary>
48
49export type MAccountBlocks = MAccountSummary &
50 PickWith<AccountModel, 'BlockedAccounts', MAccountBlocklistId[]>
51
52export type MAccountAPI = MAccountDefault &
53 PickWith<AccountModel, 'Actor', MActorAPI>
54
55export type MAccountUrl = PickWith<AccountModel, 'Actor', MActorUrl>
56export type MAccountAudience = PickWith<AccountModel, 'Actor', MActorAudience>
diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts
new file mode 100644
index 000000000..96c53d857
--- /dev/null
+++ b/server/typings/models/account/actor-follow.ts
@@ -0,0 +1,27 @@
1import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
2import { MActor, MActorAccountChannel, MActorChannel, MActorChannelAccount, MActorDefault, MActorHost, MActorUsername } from './actor'
3import { PickWith } from '../../utils'
4
5export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
6
7export type MActorFollowActors = MActorFollow &
8 PickWith<ActorFollowModel, 'ActorFollower', MActor> &
9 PickWith<ActorFollowModel, 'ActorFollowing', MActor>
10
11export type MActorFollowActorsDefault = MActorFollow &
12 PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> &
13 PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault>
14
15export type MActorFollowActorsDefaultSubscription = MActorFollow &
16 PickWith<ActorFollowModel, 'ActorFollower', MActorDefault> &
17 PickWith<ActorFollowModel, 'ActorFollowing', MActorDefault & MActorChannel>
18
19export type MActorFollowFull = MActorFollow &
20 PickWith<ActorFollowModel, 'ActorFollower', MActorAccountChannel> &
21 PickWith<ActorFollowModel, 'ActorFollowing', MActorAccountChannel>
22
23export type MActorFollowFollowingHost = MActorFollow &
24 PickWith<ActorFollowModel, 'ActorFollowing', MActorUsername & MActorHost>
25
26export type MActorFollowSubscriptions = MActorFollow &
27 PickWith<ActorFollowModel, 'ActorFollowing', MActorChannelAccount>
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts
new file mode 100644
index 000000000..f3e752a98
--- /dev/null
+++ b/server/typings/models/account/actor.ts
@@ -0,0 +1,74 @@
1import { ActorModel } from '../../../models/activitypub/actor'
2import { PickWith } from '../../utils'
3import { MAccount, MAccountActorDefault, MAccountId, MAccountIdActor } from './account'
4import { MServerHost, MServerHostBlocks, MServer } from '../server'
5import { MAvatar } from './avatar'
6import { MChannel, MChannelAccountActor, MChannelActorAccountDefault, MChannelId, MChannelIdActor } from '../video'
7
8export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
9
10export type MActorUrl = Pick<MActor, 'url'>
11export type MActorId = Pick<MActor, 'id'>
12export type MActorUsername = Pick<MActor, 'preferredUsername'>
13export type MActorHost = PickWith<ActorModel, 'Server', MServerHost>
14
15export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
16export type MActorAudience = MActorUrl & MActorFollowersUrl
17
18export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
19
20export type MActorDefaultLight = MActorLight &
21 MActorHost &
22 PickWith<ActorModel, 'Avatar', MAvatar>
23
24export type MActorAccountId = MActor &
25 PickWith<ActorModel, 'Account', MAccountId>
26export type MActorAccountIdActor = MActor &
27 PickWith<ActorModel, 'Account', MAccountIdActor>
28
29export type MActorChannelId = MActor &
30 PickWith<ActorModel, 'VideoChannel', MChannelId>
31export type MActorChannelIdActor = MActor &
32 PickWith<ActorModel, 'VideoChannel', MChannelIdActor>
33
34export type MActorAccountChannelId = MActorAccountId & MActorChannelId
35export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
36
37export type MActorAccount = MActor &
38 PickWith<ActorModel, 'Account', MAccount>
39
40export type MActorChannel = MActor &
41 PickWith<ActorModel, 'VideoChannel', MChannel>
42
43export type MActorAccountChannel = MActorAccount & MActorChannel
44
45export type MActorChannelAccount = MActor &
46 PickWith<ActorModel, 'VideoChannel', MChannelAccountActor>
47
48export type MActorServer = MActor &
49 PickWith<ActorModel, 'Server', MServer>
50
51export type MActorDefault = MActorServer &
52 PickWith<ActorModel, 'Avatar', MAvatar>
53
54export type MActorFull = MActorDefault &
55 PickWith<ActorModel, 'Account', MAccount> &
56 PickWith<ActorModel, 'VideoChannel', MChannelAccountActor>
57
58export type MActorFullActor = MActorDefault &
59 PickWith<ActorModel, 'Account', MAccountActorDefault> &
60 PickWith<ActorModel, 'VideoChannel', MChannelActorAccountDefault>
61
62export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
63 MActorHost &
64 PickWith<ActorModel, 'Avatar', MAvatar>
65
66export type MActorSummaryBlocks = Omit<MActorSummary, 'Server'> &
67 PickWith<ActorModel, 'Server', MServerHostBlocks>
68
69export type MActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'>
70
71export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
72 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
73
74export type MActorSignature = MActorAccountChannelId
diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts
new file mode 100644
index 000000000..257c48bfc
--- /dev/null
+++ b/server/typings/models/account/avatar.ts
@@ -0,0 +1,3 @@
1import { AvatarModel } from '../../../models/avatar/avatar'
2
3export type MAvatar = AvatarModel
diff --git a/server/typings/models/account/index.d.ts b/server/typings/models/account/index.d.ts
new file mode 100644
index 000000000..513c09c40
--- /dev/null
+++ b/server/typings/models/account/index.d.ts
@@ -0,0 +1,5 @@
1export * from './account'
2export * from './account-blocklist'
3export * from './actor'
4export * from './actor-follow'
5export * from './avatar'