diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-15 11:53:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-19 17:26:35 +0200 |
commit | 453e83ea5d81d203ba34bc43cd5c2c750ba40568 (patch) | |
tree | 604e02f4343d13a4ba42e1fb7527ba6ab9111712 /server/typings/models/user/user.ts | |
parent | 13176a07a95984a53cc59aec5217f2ce9806d1bc (diff) | |
download | PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.gz PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.zst PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.zip |
Stronger model typings
Diffstat (limited to 'server/typings/models/user/user.ts')
-rw-r--r-- | server/typings/models/user/user.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts new file mode 100644 index 000000000..b91eed8d9 --- /dev/null +++ b/server/typings/models/user/user.ts | |||
@@ -0,0 +1,32 @@ | |||
1 | import { UserModel } from '../../../models/account/user' | ||
2 | import { PickWith } from '../../utils' | ||
3 | import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' | ||
4 | import { MNotificationSetting } from './user-notification-setting' | ||
5 | |||
6 | export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'> | ||
7 | |||
8 | export type MUserId = Pick<UserModel, 'id'> | ||
9 | |||
10 | export type MUserWithNotificationSetting = MUser & | ||
11 | PickWith<UserModel, 'NotificationSetting', MNotificationSetting> | ||
12 | |||
13 | export type MUserAccountDefault = MUser & | ||
14 | PickWith<UserModel, 'Account', MAccountDefault> | ||
15 | |||
16 | export type MUserAccount = MUser & | ||
17 | PickWith<UserModel, 'Account', MAccount> | ||
18 | |||
19 | export type MUserAccountId = MUser & | ||
20 | PickWith<UserModel, 'Account', MAccountId> | ||
21 | |||
22 | export type MUserNotifSettingAccount = MUserWithNotificationSetting & MUserAccount | ||
23 | |||
24 | export type MUserDefault = MUser & | ||
25 | MUserWithNotificationSetting & | ||
26 | MUserAccountDefault | ||
27 | |||
28 | export type MUserChannel = MUserWithNotificationSetting & | ||
29 | PickWith<UserModel, 'Account', MAccountDefaultChannelDefault> | ||
30 | |||
31 | export type MUserAccountUrl = MUser & | ||
32 | PickWith<UserModel, 'Account', MAccountUrl & MAccountIdActorId> | ||