diff options
Diffstat (limited to 'server/types/models/account/actor.ts')
-rw-r--r-- | server/types/models/account/actor.ts | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts index 8af19c4da..8f3f30074 100644 --- a/server/types/models/account/actor.ts +++ b/server/types/models/account/actor.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' | 2 | import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' |
2 | import { ActorModel } from '../../../models/activitypub/actor' | 3 | import { ActorModel } from '../../../models/activitypub/actor' |
3 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' | 4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' |
@@ -6,6 +7,7 @@ import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './accoun | |||
6 | import { MActorImage, MActorImageFormattable } from './actor-image' | 7 | import { MActorImage, MActorImageFormattable } from './actor-image' |
7 | 8 | ||
8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> | 9 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> |
10 | type UseOpt<K extends keyof ActorModel, M> = PickWithOpt<ActorModel, K, M> | ||
9 | 11 | ||
10 | // ############################################################################ | 12 | // ############################################################################ |
11 | 13 | ||
@@ -75,11 +77,26 @@ export type MActorServer = | |||
75 | 77 | ||
76 | // Complex actor associations | 78 | // Complex actor associations |
77 | 79 | ||
80 | export type MActorImages = | ||
81 | MActor & | ||
82 | Use<'Avatar', MActorImage> & | ||
83 | UseOpt<'Banner', MActorImage> | ||
84 | |||
78 | export type MActorDefault = | 85 | export type MActorDefault = |
79 | MActor & | 86 | MActor & |
80 | Use<'Server', MServer> & | 87 | Use<'Server', MServer> & |
81 | Use<'Avatar', MActorImage> | 88 | Use<'Avatar', MActorImage> |
82 | 89 | ||
90 | export type MActorDefaultChannelId = | ||
91 | MActorDefault & | ||
92 | Use<'VideoChannel', MChannelId> | ||
93 | |||
94 | export type MActorDefaultBanner = | ||
95 | MActor & | ||
96 | Use<'Server', MServer> & | ||
97 | Use<'Avatar', MActorImage> & | ||
98 | Use<'Banner', MActorImage> | ||
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 |
85 | export type MActorChannelAccountActor = | 102 | export type MActorChannelAccountActor = |
@@ -90,6 +107,7 @@ export type MActorFull = | |||
90 | MActor & | 107 | MActor & |
91 | Use<'Server', MServer> & | 108 | Use<'Server', MServer> & |
92 | Use<'Avatar', MActorImage> & | 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 | ||
@@ -98,6 +116,7 @@ export type MActorFullActor = | |||
98 | MActor & | 116 | MActor & |
99 | Use<'Server', MServer> & | 117 | Use<'Server', MServer> & |
100 | Use<'Avatar', MActorImage> & | 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 | ||
@@ -131,9 +150,17 @@ export type MActorSummaryFormattable = | |||
131 | 150 | ||
132 | export type MActorFormattable = | 151 | export 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 | ||
137 | export type MActorAP = | 157 | type MActorAPBase = |
138 | MActor & | 158 | MActor & |
139 | Use<'Avatar', MActorImage> | 159 | Use<'Avatar', MActorImage> |
160 | |||
161 | export type MActorAPAccount = | ||
162 | MActorAPBase | ||
163 | |||
164 | export type MActorAPChannel = | ||
165 | MActorAPBase & | ||
166 | Use<'Banner', MActorImage> | ||