1 import { AccountModel } from '../../../models/account/account'
12 MActorSummaryFormattable,
15 import { FunctionProperties, PickWith } from '../../utils'
16 import { MAccountBlocklistId } from './account-blocklist'
17 import { MChannelDefault } from '@server/typings/models'
19 type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
21 // ############################################################################
23 export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
24 'VideoComments' | 'BlockedAccounts'>
26 // ############################################################################
28 // Only some attributes
29 export type MAccountId = Pick<MAccount, 'id'>
30 export type MAccountUserId = Pick<MAccount, 'userId'>
32 // Only some Actor attributes
33 export type MAccountUrl = Use<'Actor', MActorUrl>
34 export type MAccountAudience = Use<'Actor', MActorAudience>
36 export type MAccountIdActor = MAccountId &
39 export type MAccountIdActorId = MAccountId &
40 Use<'Actor', MActorId>
42 // ############################################################################
45 export type MAccountDefault = MAccount &
46 Use<'Actor', MActorDefault>
48 // Default with default association scopes
49 export type MAccountDefaultChannelDefault = MAccount &
50 Use<'Actor', MActorDefault> &
51 Use<'VideoChannels', MChannelDefault[]>
53 // We don't need some actors attributes
54 export type MAccountLight = MAccount &
55 Use<'Actor', MActorDefaultLight>
57 // ############################################################################
60 export type MAccountActor = MAccount &
63 // Full actor with server
64 export type MAccountServer = MAccount &
65 Use<'Actor', MActorServer>
67 // ############################################################################
71 export type MAccountSummary = FunctionProperties<MAccount> &
72 Pick<MAccount, 'id' | 'name'> &
73 Use<'Actor', MActorSummary>
75 export type MAccountSummaryBlocks = MAccountSummary &
76 Use<'BlockedAccounts', MAccountBlocklistId[]>
78 export type MAccountAPI = MAccount &
79 Use<'Actor', MActorAPI>
81 // ############################################################################
83 // Format for API or AP object
85 export type MAccountSummaryFormattable = FunctionProperties<MAccount> &
86 Pick<MAccount, 'id' | 'name'> &
87 Use<'Actor', MActorSummaryFormattable>
89 export type MAccountFormattable = FunctionProperties<MAccount> &
90 Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
91 Use<'Actor', MActorFormattable>