aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/user/user.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-20 19:05:31 +0200
committerChocobozzz <me@florianbigard.com>2019-08-20 19:23:10 +0200
commit1ca9f7c3f7afac2af4c4c25b98426731f7e789c6 (patch)
tree27fe65c4ea5e9250d2523033d5c65b315bfca23d /server/typings/models/user/user.ts
parent0283eaac2a8e73006c66df3cf5bb9012e37450e5 (diff)
downloadPeerTube-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.ts25
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 @@
1import { UserModel } from '../../../models/account/user' 1import { UserModel } from '../../../models/account/user'
2import { PickWith } from '../../utils' 2import { PickWith, PickWithOpt } from '../../utils'
3import { MAccount, MAccountDefault, MAccountDefaultChannelDefault, MAccountId, MAccountIdActorId, MAccountUrl } from '../account' 3import {
4import { MNotificationSetting } from './user-notification-setting' 4 MAccount,
5 MAccountDefault,
6 MAccountDefaultChannelDefault,
7 MAccountFormattable,
8 MAccountId,
9 MAccountIdActorId,
10 MAccountUrl
11} from '../account'
12import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'
13import { AccountModel } from '@server/models/account/account'
14import { MChannelFormattable } from '@server/typings/models'
5 15
6type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M> 16type 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
24export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number }
14export type MUserId = Pick<UserModel, 'id'> 25export type MUserId = Pick<UserModel, 'id'>
15 26
16// ############################################################################ 27// ############################################################################
@@ -49,3 +60,11 @@ export type MUserNotifSettingAccount = MUser &
49export type MUserDefault = MUser & 60export 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
68export type MUserFormattable = MUserQuotaUsed &
69 Use<'Account', MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>> &
70 PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>