diff options
Diffstat (limited to 'server/typings/models/user')
-rw-r--r-- | server/typings/models/user/user-notification-setting.ts | 6 | ||||
-rw-r--r-- | server/typings/models/user/user.ts | 25 |
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 @@ | |||
1 | import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' | 1 | import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' |
2 | 2 | ||
3 | export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'> | 3 | export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'> |
4 | |||
5 | // ############################################################################ | ||
6 | |||
7 | // Format for API or AP object | ||
8 | |||
9 | export 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 @@ | |||
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> | ||