1 import { UserModel } from '../../../models/account/user'
2 import { PickWith, PickWithOpt } from '../../utils'
6 MAccountDefaultChannelDefault,
12 import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'
13 import { AccountModel } from '@server/models/account/account'
14 import { MChannelFormattable } from '@server/typings/models'
16 type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>
18 // ############################################################################
20 export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>
22 // ############################################################################
24 export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number }
25 export type MUserId = Pick<UserModel, 'id'>
27 // ############################################################################
31 export type MUserAccountId = MUser &
32 Use<'Account', MAccountId>
34 export type MUserAccountUrl = MUser &
35 Use<'Account', MAccountUrl & MAccountIdActorId>
37 export type MUserAccount = MUser &
38 Use<'Account', MAccount>
40 export type MUserAccountDefault = MUser &
41 Use<'Account', MAccountDefault>
45 export type MUserNotifSettingChannelDefault = MUser &
46 Use<'NotificationSetting', MNotificationSetting> &
47 Use<'Account', MAccountDefaultChannelDefault>
49 // With notification settings
51 export type MUserWithNotificationSetting = MUser &
52 Use<'NotificationSetting', MNotificationSetting>
54 export type MUserNotifSettingAccount = MUser &
55 Use<'NotificationSetting', MNotificationSetting> &
56 Use<'Account', MAccount>
60 export type MUserDefault = MUser &
61 Use<'NotificationSetting', MNotificationSetting> &
62 Use<'Account', MAccountDefault>
64 // ############################################################################
66 // Format for API or AP object
68 export type MUserFormattable = MUserQuotaUsed &
69 Use<'Account', MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>> &
70 PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>