1 import { FunctionProperties, PickWith } from '@shared/typescript-utils'
2 import { AccountModel } from '../../../models/account/account'
14 MActorSummaryFormattable,
17 import { MChannelDefault } from '../video/video-channels'
18 import { MAccountBlocklistId } from './account-blocklist'
20 type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
22 // ############################################################################
24 export type MAccount =
25 Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
26 'VideoComments' | 'BlockedBy'>
28 // ############################################################################
30 // Only some attributes
31 export type MAccountId = Pick<MAccount, 'id'>
32 export type MAccountUserId = Pick<MAccount, 'userId'>
34 // Only some Actor attributes
35 export type MAccountUrl = Use<'Actor', MActorUrl>
36 export type MAccountAudience = Use<'Actor', MActorAudience>
38 export type MAccountIdActor =
42 export type MAccountIdActorId =
44 Use<'Actor', MActorId>
46 // ############################################################################
49 export type MAccountDefault =
51 Use<'Actor', MActorDefault>
53 // Default with default association scopes
54 export type MAccountDefaultChannelDefault =
56 Use<'Actor', MActorDefault> &
57 Use<'VideoChannels', MChannelDefault[]>
59 // We don't need some actors attributes
60 export type MAccountLight =
62 Use<'Actor', MActorDefaultLight>
64 // ############################################################################
67 export type MAccountActor =
71 export type MAccountHost =
73 Use<'Actor', MActorHost>
75 // ############################################################################
79 export type MAccountSummary =
80 FunctionProperties<MAccount> &
81 Pick<MAccount, 'id' | 'name'> &
82 Use<'Actor', MActorSummary>
84 export type MAccountSummaryBlocks =
86 Use<'BlockedBy', MAccountBlocklistId[]>
88 export type MAccountAPI =
90 Use<'Actor', MActorAPI>
92 // ############################################################################
94 // Format for API or AP object
96 export type MAccountSummaryFormattable =
97 FunctionProperties<MAccount> &
98 Pick<MAccount, 'id' | 'name'> &
99 Use<'Actor', MActorSummaryFormattable>
101 export type MAccountFormattable =
102 FunctionProperties<MAccount> &
103 Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
104 Use<'Actor', MActorFormattable>
106 export type MAccountAP =
107 Pick<MAccount, 'name' | 'description'> &
108 Use<'Actor', MActorAPAccount>