PeerTube/server/types/models/account/account-blocklist.ts

28 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-08-15 11:53:26 +02:00
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
import { PickWith } from '@shared/typescript-utils'
2019-08-20 19:05:31 +02:00
import { MAccountDefault, MAccountFormattable } from './account'
2019-08-15 11:53:26 +02:00
2019-08-20 13:52:49 +02:00
type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
// ############################################################################
2019-08-15 11:53:26 +02:00
export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
2019-08-20 13:52:49 +02:00
// ############################################################################
2019-08-15 11:53:26 +02:00
export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
2020-01-31 16:56:52 +01:00
export type MAccountBlocklistAccounts =
MAccountBlocklist &
2019-08-20 13:52:49 +02:00
Use<'ByAccount', MAccountDefault> &
Use<'BlockedAccount', MAccountDefault>
2019-08-20 19:05:31 +02:00
// ############################################################################
// Format for API or AP object
2020-01-31 16:56:52 +01:00
export type MAccountBlocklistFormattable =
Pick<MAccountBlocklist, 'createdAt'> &
2019-08-20 19:05:31 +02:00
Use<'ByAccount', MAccountFormattable> &
Use<'BlockedAccount', MAccountFormattable>