190cc0c289082cec5b76a33033c928b1a9b39151
[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 = MServerHost &
17   Use<'BlockedByAccounts', MAccountBlocklistId[]>
18
19 // ############################################################################
20
21 // Format for API or AP object
22
23 export type MServerFormattable = FunctionProperties<MServer> &
24   Pick<MServer, 'host'>