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