2019-08-15 04:53:26 -05:00
|
|
|
import { AccountModel } from '../../../models/account/account'
|
|
|
|
import {
|
|
|
|
MActor,
|
2019-08-21 07:31:57 -05:00
|
|
|
MActorAP,
|
2019-08-15 04:53:26 -05:00
|
|
|
MActorAPI,
|
|
|
|
MActorAudience,
|
|
|
|
MActorDefault,
|
2019-08-20 06:52:49 -05:00
|
|
|
MActorDefaultLight,
|
2019-08-21 01:57:00 -05:00
|
|
|
MActorFormattable,
|
2019-08-20 06:52:49 -05:00
|
|
|
MActorId,
|
2019-08-15 04:53:26 -05:00
|
|
|
MActorServer,
|
|
|
|
MActorSummary,
|
2019-08-20 12:05:31 -05:00
|
|
|
MActorSummaryFormattable,
|
2019-08-21 01:57:00 -05:00
|
|
|
MActorUrl
|
2019-08-15 04:53:26 -05:00
|
|
|
} from './actor'
|
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-blocklist'
|
2019-11-15 08:06:03 -06:00
|
|
|
import { MChannelDefault } from '../video/video-channels'
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
|
|
|
|
|
|
|
|
// ############################################################################
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccount =
|
|
|
|
Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
|
2019-08-15 04:53:26 -05:00
|
|
|
'VideoComments' | 'BlockedAccounts'>
|
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Only some attributes
|
|
|
|
export type MAccountId = Pick<MAccount, 'id'>
|
|
|
|
export type MAccountUserId = Pick<MAccount, 'userId'>
|
|
|
|
|
|
|
|
// Only some Actor attributes
|
|
|
|
export type MAccountUrl = Use<'Actor', MActorUrl>
|
|
|
|
export type MAccountAudience = Use<'Actor', MActorAudience>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountIdActor =
|
|
|
|
MAccountId &
|
2019-08-21 01:57:00 -05:00
|
|
|
Use<'Actor', MActor>
|
2019-08-20 06:52:49 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountIdActorId =
|
|
|
|
MAccountId &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorId>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
2019-08-15 04:53:26 -05:00
|
|
|
// Default scope
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountDefault =
|
|
|
|
MAccount &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefault>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// Default with default association scopes
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountDefaultChannelDefault =
|
|
|
|
MAccount &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefault> &
|
|
|
|
Use<'VideoChannels', MChannelDefault[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// We don't need some actors attributes
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountLight =
|
|
|
|
MAccount &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorDefaultLight>
|
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
|
|
|
// Full actor
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountActor =
|
|
|
|
MAccount &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActor>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2019-08-20 06:52:49 -05:00
|
|
|
// Full actor with server
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountServer =
|
|
|
|
MAccount &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorServer>
|
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
|
|
|
// For API
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountSummary =
|
|
|
|
FunctionProperties<MAccount> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Pick<MAccount, 'id' | 'name'> &
|
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 MAccountSummaryBlocks =
|
|
|
|
MAccountSummary &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'BlockedAccounts', MAccountBlocklistId[]>
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountAPI =
|
|
|
|
MAccount &
|
2019-08-20 06:52:49 -05:00
|
|
|
Use<'Actor', MActorAPI>
|
2019-08-20 12:05:31 -05:00
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Format for API or AP object
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountSummaryFormattable =
|
|
|
|
FunctionProperties<MAccount> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Pick<MAccount, 'id' | 'name'> &
|
|
|
|
Use<'Actor', MActorSummaryFormattable>
|
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountFormattable =
|
|
|
|
FunctionProperties<MAccount> &
|
2019-08-20 12:05:31 -05:00
|
|
|
Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
|
|
|
|
Use<'Actor', MActorFormattable>
|
2019-08-21 07:31:57 -05:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type MAccountAP =
|
|
|
|
Pick<MAccount, 'name' | 'description'> &
|
2019-08-21 07:31:57 -05:00
|
|
|
Use<'Actor', MActorAP>
|