PeerTube/server/typings/models/server/server.ts

27 lines
900 B
TypeScript
Raw Normal View History

2019-08-15 04:53:26 -05:00
import { ServerModel } from '../../../models/server/server'
2019-08-20 12:05:31 -05:00
import { FunctionProperties, PickWith } from '../../utils'
2019-08-15 04:53:26 -05:00
import { MAccountBlocklistId } from '../account'
2019-08-20 06:52:49 -05:00
type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
// ############################################################################
2019-08-15 04:53:26 -05:00
export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
2019-08-20 06:52:49 -05:00
// ############################################################################
2019-08-15 04:53:26 -05:00
export type MServerHost = Pick<MServer, 'host'>
2019-08-20 12:05:31 -05:00
export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>
2019-08-15 04:53:26 -05:00
2020-01-31 09:56:52 -06:00
export type MServerHostBlocks =
MServerHost &
2019-08-20 06:52:49 -05:00
Use<'BlockedByAccounts', MAccountBlocklistId[]>
2019-08-20 12:05:31 -05:00
// ############################################################################
// Format for API or AP object
2020-01-31 09:56:52 -06:00
export type MServerFormattable =
FunctionProperties<MServer> &
2019-08-20 12:05:31 -05:00
Pick<MServer, 'host'>