aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/user/user.ts
blob: 466cde33b890bf41525eeffe67190bf3fe37f4f1 (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
import { UserModel } from '../../../models/account/user'
import { PickWith } from '../../utils'
import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account'
import { MNotificationSetting } from './user-notification-setting'

type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>

// ############################################################################

export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>

// ############################################################################

export type MUserId = Pick<UserModel, 'id'>

// ############################################################################

// With account

export type MUserAccountId = MUser &
  Use<'Account', MAccountId>

export type MUserAccountUrl = MUser &
  Use<'Account', MAccountUrl & MAccountIdActorId>

export type MUserAccount = MUser &
  Use<'Account', MAccount>

export type MUserAccountDefault = MUser &
  Use<'Account', MAccountDefault>

// With channel

export type MUserNotifSettingChannelDefault = MUser &
  Use<'NotificationSetting', MNotificationSetting> &
  Use<'Account', MAccountDefaultChannelDefault>

// With notification settings

export type MUserWithNotificationSetting = MUser &
  Use<'NotificationSetting', MNotificationSetting>

export type MUserNotifSettingAccount = MUser &
  Use<'NotificationSetting', MNotificationSetting> &
  Use<'Account', MAccount>

// Default scope

export type MUserDefault = MUser &
  Use<'NotificationSetting', MNotificationSetting> &
  Use<'Account', MAccountDefault>