aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-06 11:35:56 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-04-08 10:07:53 +0200
commitf479685678406a5df864d89615b33d29085ebfc6 (patch)
tree8de15e90cd8d97d8810715df8585c61f48d5282a /server/types/models
parent968aaed2066873fc1c39f95168284122d9d15e21 (diff)
downloadPeerTube-f479685678406a5df864d89615b33d29085ebfc6.tar.gz
PeerTube-f479685678406a5df864d89615b33d29085ebfc6.tar.zst
PeerTube-f479685678406a5df864d89615b33d29085ebfc6.zip
Agnostic actor image storage
Diffstat (limited to 'server/types/models')
-rw-r--r--server/types/models/account/actor-image.ts12
-rw-r--r--server/types/models/account/actor.ts22
-rw-r--r--server/types/models/account/avatar.ts12
-rw-r--r--server/types/models/account/index.ts4
-rw-r--r--server/types/models/user/user-notification.ts6
5 files changed, 28 insertions, 28 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 @@
1import { ActorImageModel } from '../../../models/account/actor-image'
2import { FunctionProperties } from '@shared/core-utils'
3
4export type MActorImage = ActorImageModel
5
6// ############################################################################
7
8// Format for API or AP object
9
10export 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 @@
1import { ActorModel } from '../../../models/activitypub/actor'
2import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' 1import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' 2import { ActorModel } from '../../../models/activitypub/actor'
4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' 3import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
5import { MAvatar, MAvatarFormattable } from './avatar'
6import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' 4import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
5import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
6import { MActorImage, MActorImageFormattable } from './actor-image'
7 7
8type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> 8type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
9 9
10// ############################################################################ 10// ############################################################################
11 11
12export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> 12export 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
34export type MActorDefaultLight = 34export type MActorDefaultLight =
35 MActorLight & 35 MActorLight &
36 Use<'Server', MServerHost> & 36 Use<'Server', MServerHost> &
37 Use<'Avatar', MAvatar> 37 Use<'Avatar', MActorImage>
38 38
39export type MActorAccountId = 39export type MActorAccountId =
40 MActor & 40 MActor &
@@ -78,7 +78,7 @@ export type MActorServer =
78export type MActorDefault = 78export 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 =
89export type MActorFull = 89export 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 =
97export type MActorFullActor = 97export 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
114export type MActorSummaryBlocks = 114export 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
132export type MActorFormattable = 132export type MActorFormattable =
133 MActorSummaryFormattable & 133 MActorSummaryFormattable &
@@ -136,4 +136,4 @@ export type MActorFormattable =
136 136
137export type MActorAP = 137export 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 @@
1import { AvatarModel } from '../../../models/avatar/avatar'
2import { FunctionProperties } from '@shared/core-utils'
3
4export type MAvatar = AvatarModel
5
6// ############################################################################
7
8// Format for API or AP object
9
10export 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 @@
1export * from './account' 1export * from './account'
2export * from './account-blocklist' 2export * from './account-blocklist'
3export * from './actor'
4export * from './actor-follow' 3export * from './actor-follow'
5export * from './avatar' 4export * from './actor-image'
5export * from './actor'
diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts
index 6988086f1..7ebb0485d 100644
--- a/server/types/models/user/user-notification.ts
+++ b/server/types/models/user/user-notification.ts
@@ -5,10 +5,10 @@ import { PluginModel } from '@server/models/server/plugin'
5import { PickWith, PickWithOpt } from '@shared/core-utils' 5import { PickWith, PickWithOpt } from '@shared/core-utils'
6import { AbuseModel } from '../../../models/abuse/abuse' 6import { AbuseModel } from '../../../models/abuse/abuse'
7import { AccountModel } from '../../../models/account/account' 7import { AccountModel } from '../../../models/account/account'
8import { ActorImageModel } from '../../../models/account/actor-image'
8import { UserNotificationModel } from '../../../models/account/user-notification' 9import { UserNotificationModel } from '../../../models/account/user-notification'
9import { ActorModel } from '../../../models/activitypub/actor' 10import { ActorModel } from '../../../models/activitypub/actor'
10import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 11import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
11import { AvatarModel } from '../../../models/avatar/avatar'
12import { ServerModel } from '../../../models/server/server' 12import { ServerModel } from '../../../models/server/server'
13import { VideoModel } from '../../../models/video/video' 13import { VideoModel } from '../../../models/video/video'
14import { VideoBlacklistModel } from '../../../models/video/video-blacklist' 14import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
@@ -29,7 +29,7 @@ export module UserNotificationIncludes {
29 29
30 export type ActorInclude = 30 export type ActorInclude =
31 Pick<ActorModel, 'preferredUsername' | 'getHost'> & 31 Pick<ActorModel, 'preferredUsername' | 'getHost'> &
32 PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> & 32 PickWith<ActorModel, 'Avatar', Pick<ActorImageModel, 'filename' | 'getStaticPath'>> &
33 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> 33 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
34 34
35 export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'> 35 export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'>
@@ -75,7 +75,7 @@ export module UserNotificationIncludes {
75 Pick<ActorModel, 'preferredUsername' | 'getHost'> & 75 Pick<ActorModel, 'preferredUsername' | 'getHost'> &
76 PickWith<ActorModel, 'Account', AccountInclude> & 76 PickWith<ActorModel, 'Account', AccountInclude> &
77 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> & 77 PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &
78 PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> 78 PickWithOpt<ActorModel, 'Avatar', Pick<ActorImageModel, 'filename' | 'getStaticPath'>>
79 79
80 export type ActorFollowing = 80 export type ActorFollowing =
81 Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> & 81 Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &