diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-06 11:35:56 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-04-08 10:07:53 +0200 |
commit | f479685678406a5df864d89615b33d29085ebfc6 (patch) | |
tree | 8de15e90cd8d97d8810715df8585c61f48d5282a /server/types/models/account | |
parent | 968aaed2066873fc1c39f95168284122d9d15e21 (diff) | |
download | PeerTube-f479685678406a5df864d89615b33d29085ebfc6.tar.gz PeerTube-f479685678406a5df864d89615b33d29085ebfc6.tar.zst PeerTube-f479685678406a5df864d89615b33d29085ebfc6.zip |
Agnostic actor image storage
Diffstat (limited to 'server/types/models/account')
-rw-r--r-- | server/types/models/account/actor-image.ts | 12 | ||||
-rw-r--r-- | server/types/models/account/actor.ts | 22 | ||||
-rw-r--r-- | server/types/models/account/avatar.ts | 12 | ||||
-rw-r--r-- | server/types/models/account/index.ts | 4 |
4 files changed, 25 insertions, 25 deletions
diff --git a/server/types/models/account/actor-image.ts b/server/types/models/account/actor-image.ts new file mode 100644 index 000000000..e59f8b141 --- /dev/null +++ b/server/types/models/account/actor-image.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { ActorImageModel } from '../../../models/account/actor-image' | ||
2 | import { FunctionProperties } from '@shared/core-utils' | ||
3 | |||
4 | export type MActorImage = ActorImageModel | ||
5 | |||
6 | // ############################################################################ | ||
7 | |||
8 | // Format for API or AP object | ||
9 | |||
10 | export type MActorImageFormattable = | ||
11 | FunctionProperties<MActorImage> & | ||
12 | Pick<MActorImage, 'filename' | 'createdAt' | 'updatedAt'> | ||
diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts index ee0d05f4e..8af19c4da 100644 --- a/server/types/models/account/actor.ts +++ b/server/types/models/account/actor.ts | |||
@@ -1,15 +1,15 @@ | |||
1 | import { ActorModel } from '../../../models/activitypub/actor' | ||
2 | import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' | 1 | import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' |
3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' | 2 | import { ActorModel } from '../../../models/activitypub/actor' |
4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' | 3 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' |
5 | import { MAvatar, MAvatarFormattable } from './avatar' | ||
6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' | 4 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' |
5 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' | ||
6 | import { MActorImage, MActorImageFormattable } from './actor-image' | ||
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> |
9 | 9 | ||
10 | // ############################################################################ | 10 | // ############################################################################ |
11 | 11 | ||
12 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> | 12 | export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server' | 'Banner'> |
13 | 13 | ||
14 | // ############################################################################ | 14 | // ############################################################################ |
15 | 15 | ||
@@ -34,7 +34,7 @@ export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServ | |||
34 | export type MActorDefaultLight = | 34 | export type MActorDefaultLight = |
35 | MActorLight & | 35 | MActorLight & |
36 | Use<'Server', MServerHost> & | 36 | Use<'Server', MServerHost> & |
37 | Use<'Avatar', MAvatar> | 37 | Use<'Avatar', MActorImage> |
38 | 38 | ||
39 | export type MActorAccountId = | 39 | export type MActorAccountId = |
40 | MActor & | 40 | MActor & |
@@ -78,7 +78,7 @@ export type MActorServer = | |||
78 | export type MActorDefault = | 78 | export type MActorDefault = |
79 | MActor & | 79 | MActor & |
80 | Use<'Server', MServer> & | 80 | Use<'Server', MServer> & |
81 | Use<'Avatar', MAvatar> | 81 | Use<'Avatar', MActorImage> |
82 | 82 | ||
83 | // 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 |
84 | // Actor -> VideoChannel -> Account -> Actor | 84 | // Actor -> VideoChannel -> Account -> Actor |
@@ -89,7 +89,7 @@ export type MActorChannelAccountActor = | |||
89 | export type MActorFull = | 89 | export type MActorFull = |
90 | MActor & | 90 | MActor & |
91 | Use<'Server', MServer> & | 91 | Use<'Server', MServer> & |
92 | Use<'Avatar', MAvatar> & | 92 | Use<'Avatar', MActorImage> & |
93 | Use<'Account', MAccount> & | 93 | Use<'Account', MAccount> & |
94 | Use<'VideoChannel', MChannelAccountActor> | 94 | Use<'VideoChannel', MChannelAccountActor> |
95 | 95 | ||
@@ -97,7 +97,7 @@ export type MActorFull = | |||
97 | export type MActorFullActor = | 97 | export type MActorFullActor = |
98 | MActor & | 98 | MActor & |
99 | Use<'Server', MServer> & | 99 | Use<'Server', MServer> & |
100 | Use<'Avatar', MAvatar> & | 100 | Use<'Avatar', MActorImage> & |
101 | Use<'Account', MAccountDefault> & | 101 | Use<'Account', MAccountDefault> & |
102 | Use<'VideoChannel', MChannelAccountDefault> | 102 | Use<'VideoChannel', MChannelAccountDefault> |
103 | 103 | ||
@@ -109,7 +109,7 @@ export type MActorSummary = | |||
109 | FunctionProperties<MActor> & | 109 | FunctionProperties<MActor> & |
110 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | 110 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & |
111 | Use<'Server', MServerHost> & | 111 | Use<'Server', MServerHost> & |
112 | Use<'Avatar', MAvatar> | 112 | Use<'Avatar', MActorImage> |
113 | 113 | ||
114 | export type MActorSummaryBlocks = | 114 | export type MActorSummaryBlocks = |
115 | MActorSummary & | 115 | MActorSummary & |
@@ -127,7 +127,7 @@ export type MActorSummaryFormattable = | |||
127 | FunctionProperties<MActor> & | 127 | FunctionProperties<MActor> & |
128 | Pick<MActor, 'url' | 'preferredUsername'> & | 128 | Pick<MActor, 'url' | 'preferredUsername'> & |
129 | Use<'Server', MServerHost> & | 129 | Use<'Server', MServerHost> & |
130 | Use<'Avatar', MAvatarFormattable> | 130 | Use<'Avatar', MActorImageFormattable> |
131 | 131 | ||
132 | export type MActorFormattable = | 132 | export type MActorFormattable = |
133 | MActorSummaryFormattable & | 133 | MActorSummaryFormattable & |
@@ -136,4 +136,4 @@ export type MActorFormattable = | |||
136 | 136 | ||
137 | export type MActorAP = | 137 | export type MActorAP = |
138 | MActor & | 138 | MActor & |
139 | Use<'Avatar', MAvatar> | 139 | Use<'Avatar', MActorImage> |
diff --git a/server/types/models/account/avatar.ts b/server/types/models/account/avatar.ts deleted file mode 100644 index 0489a8599..000000000 --- a/server/types/models/account/avatar.ts +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | import { AvatarModel } from '../../../models/avatar/avatar' | ||
2 | import { FunctionProperties } from '@shared/core-utils' | ||
3 | |||
4 | export type MAvatar = AvatarModel | ||
5 | |||
6 | // ############################################################################ | ||
7 | |||
8 | // Format for API or AP object | ||
9 | |||
10 | export type MAvatarFormattable = | ||
11 | FunctionProperties<MAvatar> & | ||
12 | Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'> | ||
diff --git a/server/types/models/account/index.ts b/server/types/models/account/index.ts index 513c09c40..e3fc00f94 100644 --- a/server/types/models/account/index.ts +++ b/server/types/models/account/index.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | export * from './account' | 1 | export * from './account' |
2 | export * from './account-blocklist' | 2 | export * from './account-blocklist' |
3 | export * from './actor' | ||
4 | export * from './actor-follow' | 3 | export * from './actor-follow' |
5 | export * from './avatar' | 4 | export * from './actor-image' |
5 | export * from './actor' | ||