aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/models/user
diff options
context:
space:
mode:
Diffstat (limited to 'server/typings/models/user')
-rw-r--r--server/typings/models/user/user-notification-setting.ts6
-rw-r--r--server/typings/models/user/user.ts25
2 files changed, 28 insertions, 3 deletions
diff --git a/server/typings/models/user/user-notification-setting.ts b/server/typings/models/user/user-notification-setting.ts
index 585d30a66..c674add1b 100644
--- a/server/typings/models/user/user-notification-setting.ts
+++ b/server/typings/models/user/user-notification-setting.ts
@@ -1,3 +1,9 @@
1import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' 1import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting'
2 2
3export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'> 3export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>
4
5// ############################################################################
6
7// Format for API or AP object
8
9export type MNotificationSettingFormattable = MNotificationSetting
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>