1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
import { AccountModel } from '../../../models/account/account'
import {
MActor,
MActorAP,
MActorAPI,
MActorAudience,
MActorDefault,
MActorDefaultLight,
MActorFormattable,
MActorId,
MActorServer,
MActorSummary,
MActorSummaryFormattable,
MActorUrl
} from './actor'
import { FunctionProperties, PickWith } from '../../utils'
import { MAccountBlocklistId } from './account-blocklist'
import { MChannelDefault } from '../video/video-channels'
type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
// ############################################################################
export type MAccount =
Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
'VideoComments' | 'BlockedAccounts'>
// ############################################################################
// 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>
export type MAccountIdActor =
MAccountId &
Use<'Actor', MActor>
export type MAccountIdActorId =
MAccountId &
Use<'Actor', MActorId>
// ############################################################################
// Default scope
export type MAccountDefault =
MAccount &
Use<'Actor', MActorDefault>
// Default with default association scopes
export type MAccountDefaultChannelDefault =
MAccount &
Use<'Actor', MActorDefault> &
Use<'VideoChannels', MChannelDefault[]>
// We don't need some actors attributes
export type MAccountLight =
MAccount &
Use<'Actor', MActorDefaultLight>
// ############################################################################
// Full actor
export type MAccountActor =
MAccount &
Use<'Actor', MActor>
// Full actor with server
export type MAccountServer =
MAccount &
Use<'Actor', MActorServer>
// ############################################################################
// For API
export type MAccountSummary =
FunctionProperties<MAccount> &
Pick<MAccount, 'id' | 'name'> &
Use<'Actor', MActorSummary>
export type MAccountSummaryBlocks =
MAccountSummary &
Use<'BlockedAccounts', MAccountBlocklistId[]>
export type MAccountAPI =
MAccount &
Use<'Actor', MActorAPI>
// ############################################################################
// Format for API or AP object
export type MAccountSummaryFormattable =
FunctionProperties<MAccount> &
Pick<MAccount, 'id' | 'name'> &
Use<'Actor', MActorSummaryFormattable>
export type MAccountFormattable =
FunctionProperties<MAccount> &
Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
Use<'Actor', MActorFormattable>
export type MAccountAP =
Pick<MAccount, 'name' | 'description'> &
Use<'Actor', MActorAP>
|