]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/typings/models/account/account.ts
Stronger model typings
[github/Chocobozzz/PeerTube.git] / server / typings / models / account / account.ts
1 import { AccountModel } from '../../../models/account/account'
2 import {
3 MActor,
4 MActorAccountChannelId,
5 MActorAPI,
6 MActorAudience,
7 MActorDefault,
8 MActorDefaultLight, MActorId,
9 MActorServer,
10 MActorSummary,
11 MActorUrl
12 } from './actor'
13 import { PickWith } from '../../utils'
14 import { MAccountBlocklistId } from './account-blocklist'
15 import { MChannelDefault } from '@server/typings/models'
16
17 export type MAccountId = Pick<AccountModel, 'id'>
18 export type MAccountIdActor = MAccountId &
19 PickWith<AccountModel, 'Actor', MActorAccountChannelId>
20 export type MAccountIdActorId = MAccountId &
21 PickWith<AccountModel, 'Actor', MActorId>
22
23 export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
24 'VideoComments' | 'BlockedAccounts'>
25
26 // Default scope
27 export type MAccountDefault = MAccount &
28 PickWith<AccountModel, 'Actor', MActorDefault>
29
30 export type MAccountDefaultChannelDefault = MAccountDefault &
31 PickWith<AccountModel, 'VideoChannels', MChannelDefault[]>
32
33 export type MAccountLight = MAccount &
34 PickWith<AccountModel, 'Actor', MActorDefaultLight>
35
36 export type MAccountUserId = Pick<MAccount, 'userId'>
37
38 export type MAccountActor = MAccount &
39 PickWith<AccountModel, 'Actor', MActor>
40 export type MAccountServer = MAccountActor &
41 PickWith<AccountModel, 'Actor', MActorServer>
42
43 export type MAccountActorDefault = MAccount &
44 PickWith<AccountModel, 'Actor', MActorDefault>
45
46 export type MAccountSummary = Pick<MAccount, 'id' | 'name'> &
47 PickWith<AccountModel, 'Actor', MActorSummary>
48
49 export type MAccountBlocks = MAccountSummary &
50 PickWith<AccountModel, 'BlockedAccounts', MAccountBlocklistId[]>
51
52 export type MAccountAPI = MAccountDefault &
53 PickWith<AccountModel, 'Actor', MActorAPI>
54
55 export type MAccountUrl = PickWith<AccountModel, 'Actor', MActorUrl>
56 export type MAccountAudience = PickWith<AccountModel, 'Actor', MActorAudience>