aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/account/account.ts
blob: f3646d5102dcb54e64fb73ce6b80b6bf4e7814a0 (plain) (blame)
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
import { AccountModel } from '../../../models/account/account'
import {
  MActor,
  MActorAccountChannelId,
  MActorAPI,
  MActorAudience,
  MActorDefault,
  MActorDefaultLight, MActorId,
  MActorServer,
  MActorSummary,
  MActorUrl
} from './actor'
import { PickWith } from '../../utils'
import { MAccountBlocklistId } from './account-blocklist'
import { MChannelDefault } from '@server/typings/models'

export type MAccountId = Pick<AccountModel, 'id'>
export type MAccountIdActor = MAccountId &
  PickWith<AccountModel, 'Actor', MActorAccountChannelId>
export type MAccountIdActorId = MAccountId &
  PickWith<AccountModel, 'Actor', MActorId>

export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
  'VideoComments' | 'BlockedAccounts'>

// Default scope
export type MAccountDefault = MAccount &
  PickWith<AccountModel, 'Actor', MActorDefault>

export type MAccountDefaultChannelDefault = MAccountDefault &
  PickWith<AccountModel, 'VideoChannels', MChannelDefault[]>

export type MAccountLight = MAccount &
  PickWith<AccountModel, 'Actor', MActorDefaultLight>

export type MAccountUserId = Pick<MAccount, 'userId'>

export type MAccountActor = MAccount &
  PickWith<AccountModel, 'Actor', MActor>
export type MAccountServer = MAccountActor &
  PickWith<AccountModel, 'Actor', MActorServer>

export type MAccountActorDefault = MAccount &
  PickWith<AccountModel, 'Actor', MActorDefault>

export type MAccountSummary = Pick<MAccount, 'id' | 'name'> &
  PickWith<AccountModel, 'Actor', MActorSummary>

export type MAccountBlocks = MAccountSummary &
  PickWith<AccountModel, 'BlockedAccounts', MAccountBlocklistId[]>

export type MAccountAPI = MAccountDefault &
  PickWith<AccountModel, 'Actor', MActorAPI>

export type MAccountUrl = PickWith<AccountModel, 'Actor', MActorUrl>
export type MAccountAudience = PickWith<AccountModel, 'Actor', MActorAudience>