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 '@server/typings/models'
20 type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
22 // ############################################################################
24 export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
25 'VideoComments' | 'BlockedAccounts'>
27 // ############################################################################
29 // Only some attributes
30 export type MAccountId = Pick<MAccount, 'id'>
31 export type MAccountUserId = Pick<MAccount, 'userId'>
33 // Only some Actor attributes
34 export type MAccountUrl = Use<'Actor', MActorUrl>
35 export type MAccountAudience = Use<'Actor', MActorAudience>
37 export type MAccountIdActor = MAccountId &
40 export type MAccountIdActorId = MAccountId &
41 Use<'Actor', MActorId>
43 // ############################################################################
46 export type MAccountDefault = MAccount &
47 Use<'Actor', MActorDefault>
49 // Default with default association scopes
50 export type MAccountDefaultChannelDefault = MAccount &
51 Use<'Actor', MActorDefault> &
52 Use<'VideoChannels', MChannelDefault[]>
54 // We don't need some actors attributes
55 export type MAccountLight = MAccount &
56 Use<'Actor', MActorDefaultLight>
58 // ############################################################################
61 export type MAccountActor = MAccount &
64 // Full actor with server
65 export type MAccountServer = MAccount &
66 Use<'Actor', MActorServer>
68 // ############################################################################
72 export type MAccountSummary = FunctionProperties<MAccount> &
73 Pick<MAccount, 'id' | 'name'> &
74 Use<'Actor', MActorSummary>
76 export type MAccountSummaryBlocks = MAccountSummary &
77 Use<'BlockedAccounts', MAccountBlocklistId[]>
79 export type MAccountAPI = MAccount &
80 Use<'Actor', MActorAPI>
82 // ############################################################################
84 // Format for API or AP object
86 export type MAccountSummaryFormattable = FunctionProperties<MAccount> &
87 Pick<MAccount, 'id' | 'name'> &
88 Use<'Actor', MActorSummaryFormattable>
90 export type MAccountFormattable = FunctionProperties<MAccount> &
91 Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
92 Use<'Actor', MActorFormattable>
94 export type MAccountAP = Pick<MAccount, 'name' | 'description'> &
95 Use<'Actor', MActorAP>