1 import { AccountModel } from '../../../models/account/account'
13 MActorSummaryFormattable,
16 import { FunctionProperties, PickWith } from '../../utils'
17 import { MAccountBlocklistId } from './account-blocklist'
18 import { MChannelDefault } from '../video/video-channels'
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' | 'BlockedAccounts'>
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 // Full actor with server
72 export type MAccountServer =
74 Use<'Actor', MActorServer>
76 // ############################################################################
80 export type MAccountSummary =
81 FunctionProperties<MAccount> &
82 Pick<MAccount, 'id' | 'name'> &
83 Use<'Actor', MActorSummary>
85 export type MAccountSummaryBlocks =
87 Use<'BlockedAccounts', MAccountBlocklistId[]>
89 export type MAccountAPI =
91 Use<'Actor', MActorAPI>
93 // ############################################################################
95 // Format for API or AP object
97 export type MAccountSummaryFormattable =
98 FunctionProperties<MAccount> &
99 Pick<MAccount, 'id' | 'name'> &
100 Use<'Actor', MActorSummaryFormattable>
102 export type MAccountFormattable =
103 FunctionProperties<MAccount> &
104 Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
105 Use<'Actor', MActorFormattable>
107 export type MAccountAP =
108 Pick<MAccount, 'name' | 'description'> &
109 Use<'Actor', MActorAP>