b35e55aeb556d1e139f41438487239217adc788c
[oweals/peertube.git] / server / typings / models / server / server.ts
1 import { ServerModel } from '../../../models/server/server'
2 import { FunctionProperties, PickWith } from '../../utils'
3 import { MAccountBlocklistId } from '../account'
4
5 type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
6
7 // ############################################################################
8
9 export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
10
11 // ############################################################################
12
13 export type MServerHost = Pick<MServer, 'host'>
14 export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>
15
16 export type MServerHostBlocks =
17   MServerHost &
18   Use<'BlockedByAccounts', MAccountBlocklistId[]>
19
20 // ############################################################################
21
22 // Format for API or AP object
23
24 export type MServerFormattable =
25   FunctionProperties<MServer> &
26   Pick<MServer, 'host'>