]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/types/models/account/actor.ts
Add banners support
[github/Chocobozzz/PeerTube.git] / server / types / models / account / actor.ts
index 8af19c4da7174b1ae2335bef0077928d9c3acede..8f3f30074ef3026d1b3631ab188b4806fa2aed4a 100644 (file)
@@ -1,3 +1,4 @@
+
 import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
 import { ActorModel } from '../../../models/activitypub/actor'
 import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
@@ -6,6 +7,7 @@ import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './accoun
 import { MActorImage, MActorImageFormattable } from './actor-image'
 
 type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
+type UseOpt<K extends keyof ActorModel, M> = PickWithOpt<ActorModel, K, M>
 
 // ############################################################################
 
@@ -75,11 +77,26 @@ export type MActorServer =
 
 // Complex actor associations
 
+export type MActorImages =
+  MActor &
+  Use<'Avatar', MActorImage> &
+  UseOpt<'Banner', MActorImage>
+
 export type MActorDefault =
   MActor &
   Use<'Server', MServer> &
   Use<'Avatar', MActorImage>
 
+export type MActorDefaultChannelId =
+  MActorDefault &
+  Use<'VideoChannel', MChannelId>
+
+export type MActorDefaultBanner =
+  MActor &
+  Use<'Server', MServer> &
+  Use<'Avatar', MActorImage> &
+  Use<'Banner', MActorImage>
+
 // Actor with channel that is associated to an account and its actor
 // Actor -> VideoChannel -> Account -> Actor
 export type MActorChannelAccountActor =
@@ -90,6 +107,7 @@ export type MActorFull =
   MActor &
   Use<'Server', MServer> &
   Use<'Avatar', MActorImage> &
+  Use<'Banner', MActorImage> &
   Use<'Account', MAccount> &
   Use<'VideoChannel', MChannelAccountActor>
 
@@ -98,6 +116,7 @@ export type MActorFullActor =
   MActor &
   Use<'Server', MServer> &
   Use<'Avatar', MActorImage> &
+  Use<'Banner', MActorImage> &
   Use<'Account', MAccountDefault> &
   Use<'VideoChannel', MChannelAccountDefault>
 
@@ -131,9 +150,17 @@ export type MActorSummaryFormattable =
 
 export type MActorFormattable =
   MActorSummaryFormattable &
-  Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &
-  Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>
+  Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt' | 'bannerId' | 'avatarId'> &
+  Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> &
+  UseOpt<'Banner', MActorImageFormattable>
 
-export type MActorAP =
+type MActorAPBase =
   MActor &
   Use<'Avatar', MActorImage>
+
+export type MActorAPAccount =
+  MActorAPBase
+
+export type MActorAPChannel =
+  MActorAPBase &
+  Use<'Banner', MActorImage>