diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-20 19:05:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-20 19:23:10 +0200 |
commit | 1ca9f7c3f7afac2af4c4c25b98426731f7e789c6 (patch) | |
tree | 27fe65c4ea5e9250d2523033d5c65b315bfca23d /server/typings/models/user/user.ts | |
parent | 0283eaac2a8e73006c66df3cf5bb9012e37450e5 (diff) | |
download | PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.tar.gz PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.tar.zst PeerTube-1ca9f7c3f7afac2af4c4c25b98426731f7e789c6.zip |
Type toFormattedJSON
Diffstat (limited to 'server/typings/models/user/user.ts')
-rw-r--r-- | server/typings/models/user/user.ts | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts index 466cde33b..52d6d4a05 100644 --- a/server/typings/models/user/user.ts +++ b/server/typings/models/user/user.ts | |||
@@ -1,7 +1,17 @@ | |||
1 | import { UserModel } from '../../../models/account/user' | 1 | import { UserModel } from '../../../models/account/user' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' | 3 | import { |
4 | import { MNotificationSetting } from './user-notification-setting' | 4 | MAccount, |
5 | MAccountDefault, | ||
6 | MAccountDefaultChannelDefault, | ||
7 | MAccountFormattable, | ||
8 | MAccountId, | ||
9 | MAccountIdActorId, | ||
10 | MAccountUrl | ||
11 | } from '../account' | ||
12 | import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting' | ||
13 | import { AccountModel } from '@server/models/account/account' | ||
14 | import { MChannelFormattable } from '@server/typings/models' | ||
5 | 15 | ||
6 | type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M> | 16 | type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M> |
7 | 17 | ||
@@ -11,6 +21,7 @@ export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoIm | |||
11 | 21 | ||
12 | // ############################################################################ | 22 | // ############################################################################ |
13 | 23 | ||
24 | export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number } | ||
14 | export type MUserId = Pick<UserModel, 'id'> | 25 | export type MUserId = Pick<UserModel, 'id'> |
15 | 26 | ||
16 | // ############################################################################ | 27 | // ############################################################################ |
@@ -49,3 +60,11 @@ export type MUserNotifSettingAccount = MUser & | |||
49 | export type MUserDefault = MUser & | 60 | export type MUserDefault = MUser & |
50 | Use<'NotificationSetting', MNotificationSetting> & | 61 | Use<'NotificationSetting', MNotificationSetting> & |
51 | Use<'Account', MAccountDefault> | 62 | Use<'Account', MAccountDefault> |
63 | |||
64 | // ############################################################################ | ||
65 | |||
66 | // Format for API or AP object | ||
67 | |||
68 | export type MUserFormattable = MUserQuotaUsed & | ||
69 | Use<'Account', MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>> & | ||
70 | PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable> | ||