aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types/models/account/actor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/types/models/account/actor.ts')
-rw-r--r--server/types/models/account/actor.ts55
1 files changed, 41 insertions, 14 deletions
diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts
index ee0d05f4e..8f3f30074 100644
--- a/server/types/models/account/actor.ts
+++ b/server/types/models/account/actor.ts
@@ -1,15 +1,17 @@
1import { ActorModel } from '../../../models/activitypub/actor' 1
2import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' 2import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' 3import { ActorModel } from '../../../models/activitypub/actor'
4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' 4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
5import { MAvatar, MAvatarFormattable } from './avatar'
6import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' 5import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
6import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
7import { MActorImage, MActorImageFormattable } from './actor-image'
7 8
8type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> 9type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
10type UseOpt<K extends keyof ActorModel, M> = PickWithOpt<ActorModel, K, M>
9 11
10// ############################################################################ 12// ############################################################################
11 13
12export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> 14export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server' | 'Banner'>
13 15
14// ############################################################################ 16// ############################################################################
15 17
@@ -34,7 +36,7 @@ export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServ
34export type MActorDefaultLight = 36export type MActorDefaultLight =
35 MActorLight & 37 MActorLight &
36 Use<'Server', MServerHost> & 38 Use<'Server', MServerHost> &
37 Use<'Avatar', MAvatar> 39 Use<'Avatar', MActorImage>
38 40
39export type MActorAccountId = 41export type MActorAccountId =
40 MActor & 42 MActor &
@@ -75,10 +77,25 @@ export type MActorServer =
75 77
76// Complex actor associations 78// Complex actor associations
77 79
80export type MActorImages =
81 MActor &
82 Use<'Avatar', MActorImage> &
83 UseOpt<'Banner', MActorImage>
84
78export type MActorDefault = 85export type MActorDefault =
79 MActor & 86 MActor &
80 Use<'Server', MServer> & 87 Use<'Server', MServer> &
81 Use<'Avatar', MAvatar> 88 Use<'Avatar', MActorImage>
89
90export type MActorDefaultChannelId =
91 MActorDefault &
92 Use<'VideoChannel', MChannelId>
93
94export type MActorDefaultBanner =
95 MActor &
96 Use<'Server', MServer> &
97 Use<'Avatar', MActorImage> &
98 Use<'Banner', MActorImage>
82 99
83// Actor with channel that is associated to an account and its actor 100// Actor with channel that is associated to an account and its actor
84// Actor -> VideoChannel -> Account -> Actor 101// Actor -> VideoChannel -> Account -> Actor
@@ -89,7 +106,8 @@ export type MActorChannelAccountActor =
89export type MActorFull = 106export type MActorFull =
90 MActor & 107 MActor &
91 Use<'Server', MServer> & 108 Use<'Server', MServer> &
92 Use<'Avatar', MAvatar> & 109 Use<'Avatar', MActorImage> &
110 Use<'Banner', MActorImage> &
93 Use<'Account', MAccount> & 111 Use<'Account', MAccount> &
94 Use<'VideoChannel', MChannelAccountActor> 112 Use<'VideoChannel', MChannelAccountActor>
95 113
@@ -97,7 +115,8 @@ export type MActorFull =
97export type MActorFullActor = 115export type MActorFullActor =
98 MActor & 116 MActor &
99 Use<'Server', MServer> & 117 Use<'Server', MServer> &
100 Use<'Avatar', MAvatar> & 118 Use<'Avatar', MActorImage> &
119 Use<'Banner', MActorImage> &
101 Use<'Account', MAccountDefault> & 120 Use<'Account', MAccountDefault> &
102 Use<'VideoChannel', MChannelAccountDefault> 121 Use<'VideoChannel', MChannelAccountDefault>
103 122
@@ -109,7 +128,7 @@ export type MActorSummary =
109 FunctionProperties<MActor> & 128 FunctionProperties<MActor> &
110 Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & 129 Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
111 Use<'Server', MServerHost> & 130 Use<'Server', MServerHost> &
112 Use<'Avatar', MAvatar> 131 Use<'Avatar', MActorImage>
113 132
114export type MActorSummaryBlocks = 133export type MActorSummaryBlocks =
115 MActorSummary & 134 MActorSummary &
@@ -127,13 +146,21 @@ export type MActorSummaryFormattable =
127 FunctionProperties<MActor> & 146 FunctionProperties<MActor> &
128 Pick<MActor, 'url' | 'preferredUsername'> & 147 Pick<MActor, 'url' | 'preferredUsername'> &
129 Use<'Server', MServerHost> & 148 Use<'Server', MServerHost> &
130 Use<'Avatar', MAvatarFormattable> 149 Use<'Avatar', MActorImageFormattable>
131 150
132export type MActorFormattable = 151export type MActorFormattable =
133 MActorSummaryFormattable & 152 MActorSummaryFormattable &
134 Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & 153 Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt' | 'bannerId' | 'avatarId'> &
135 Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> 154 Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> &
155 UseOpt<'Banner', MActorImageFormattable>
136 156
137export type MActorAP = 157type MActorAPBase =
138 MActor & 158 MActor &
139 Use<'Avatar', MAvatar> 159 Use<'Avatar', MActorImage>
160
161export type MActorAPAccount =
162 MActorAPBase
163
164export type MActorAPChannel =
165 MActorAPBase &
166 Use<'Banner', MActorImage>