2019-08-20 12:05:31 -05:00
|
|
|
import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
|
2019-08-15 04:53:26 -05:00
|
|
|
import { VideoChannelModel } from '../../../models/video/video-channel'
|
|
|
|
import {
|
|
|
|
MAccountActor,
|
|
|
|
MAccountAPI,
|
|
|
|
MAccountDefault,
|
2019-08-20 12:05:31 -05:00
|
|
|
MAccountFormattable,
|
2019-08-15 04:53:26 -05:00
|
|
|
MAccountLight,
|
2019-08-20 06:52:49 -05:00
|
|
|
MAccountSummaryBlocks,
|
2019-08-20 12:05:31 -05:00
|
|
|
MAccountSummaryFormattable,
|
2019-08-21 07:31:57 -05:00
|
|
|
MAccountUrl,
|
2019-08-15 04:53:26 -05:00
|
|
|
MAccountUserId,
|
|
|
|
MActor,
|
|
|
|
MActorAccountChannelId,
|
2019-08-21 07:31:57 -05:00
|
|
|
MActorAP,
|
2019-08-15 04:53:26 -05:00
|
|
|
MActorAPI,
|
|
|
|
MActorDefault,
|
2019-08-20 06:52:49 -05:00
|
|
|
MActorDefaultLight,
|
2019-08-20 12:05:31 -05:00
|
|
|
MActorFormattable,
|
2019-08-20 06:52:49 -05:00
|
|
|
MActorLight,
|
2019-08-20 12:05:31 -05:00
|
|
|
MActorSummary,
|
2019-08-21 07:31:57 -05:00
|
|
|
MActorSummaryFormattable, MActorUrl
|
2019-08-15 04:53:26 -05:00
|
|
|
} from '../account'
|
|
|
|
import { MVideo } from './video'
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
|
|
|
|
|
|
|
|
// ############################################################################
|
2019-08-15 04:53:26 -05:00
|
|
|
|
|
|
|
export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
export type MChannelId = Pick<MChannel, 'id'>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelIdActor =
|
|
|
|
MChannelId &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorAccountChannelId>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelUserId =
|
|
|
|
Pick<MChannel, 'accountId'> &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Account', MAccountUserId>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelActor =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActor>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-21 07:31:57 -05:00
|
|
|
export type MChannelUrl = Use<'Actor', MActorUrl>
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
// Default scope
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelDefault =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefault>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Not all association attributes
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelLight =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefaultLight>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelActorLight =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorLight>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelAccountLight =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefaultLight> &
|
|
|
|
Use<'Account', MAccountLight>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// Account associations
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelAccountActor =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Account', MAccountActor>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelAccountDefault =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefault> &
|
|
|
|
Use<'Account', MAccountDefault>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelActorAccountActor =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Account', MAccountActor> &
|
|
|
|
Use<'Actor', MActor>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Videos associations
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelVideos =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Videos', MVideo[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelActorAccountDefaultVideos =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefault> &
|
|
|
|
Use<'Account', MAccountDefault> &
|
|
|
|
Use<'Videos', MVideo[]>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// For API
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelSummary =
|
|
|
|
FunctionProperties<MChannel> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorSummary>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelSummaryAccount =
|
|
|
|
MChannelSummary &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Account', MAccountSummaryBlocks>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelAPI =
|
|
|
|
MChannel &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorAPI> &
|
|
|
|
Use<'Account', MAccountAPI>
|
2019-08-20 12:05:31 -05:00
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Format for API or AP object
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelSummaryFormattable =
|
|
|
|
FunctionProperties<MChannel> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Pick<MChannel, 'id' | 'name'> &
|
|
|
|
Use<'Actor', MActorSummaryFormattable>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelAccountSummaryFormattable =
|
|
|
|
MChannelSummaryFormattable &
|
2019-08-20 12:05:31 -05:00
|
|
|
Use<'Account', MAccountSummaryFormattable>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelFormattable =
|
|
|
|
FunctionProperties<MChannel> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
|
|
|
|
Use<'Actor', MActorFormattable> &
|
|
|
|
PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
|
2019-08-21 07:31:57 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MChannelAP =
|
|
|
|
Pick<MChannel, 'name' | 'description' | 'support'> &
|
2019-08-21 07:31:57 -05:00
|
|
|
Use<'Actor', MActorAP> &
|
|
|
|
Use<'Account', MAccountUrl>
|