diff options
Diffstat (limited to 'server/typings/models/user')
-rw-r--r-- | server/typings/models/user/user-notification.ts | 42 | ||||
-rw-r--r-- | server/typings/models/user/user.ts | 33 |
2 files changed, 50 insertions, 25 deletions
diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts index 1cdc691b0..2080360e1 100644 --- a/server/typings/models/user/user-notification.ts +++ b/server/typings/models/user/user-notification.ts | |||
@@ -16,59 +16,73 @@ type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationMo | |||
16 | 16 | ||
17 | // ############################################################################ | 17 | // ############################################################################ |
18 | 18 | ||
19 | export namespace UserNotificationIncludes { | 19 | export module UserNotificationIncludes { |
20 | |||
20 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> | 21 | export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'> |
21 | export type VideoIncludeChannel = VideoInclude & | 22 | export type VideoIncludeChannel = |
23 | VideoInclude & | ||
22 | PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor> | 24 | PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor> |
23 | 25 | ||
24 | export type ActorInclude = Pick<ActorModel, 'preferredUsername' | 'getHost'> & | 26 | export type ActorInclude = |
27 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & | ||
25 | PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> & | 28 | PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> & |
26 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> | 29 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> |
27 | 30 | ||
28 | export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'> | 31 | export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'> |
29 | export type VideoChannelIncludeActor = VideoChannelInclude & | 32 | export type VideoChannelIncludeActor = |
33 | VideoChannelInclude & | ||
30 | PickWith<VideoChannelModel, 'Actor', ActorInclude> | 34 | PickWith<VideoChannelModel, 'Actor', ActorInclude> |
31 | 35 | ||
32 | export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'> | 36 | export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'> |
33 | export type AccountIncludeActor = AccountInclude & | 37 | export type AccountIncludeActor = |
38 | AccountInclude & | ||
34 | PickWith<AccountModel, 'Actor', ActorInclude> | 39 | PickWith<AccountModel, 'Actor', ActorInclude> |
35 | 40 | ||
36 | export type VideoCommentInclude = Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> & | 41 | export type VideoCommentInclude = |
42 | Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> & | ||
37 | PickWith<VideoCommentModel, 'Account', AccountIncludeActor> & | 43 | PickWith<VideoCommentModel, 'Account', AccountIncludeActor> & |
38 | PickWith<VideoCommentModel, 'Video', VideoInclude> | 44 | PickWith<VideoCommentModel, 'Video', VideoInclude> |
39 | 45 | ||
40 | export type VideoAbuseInclude = Pick<VideoAbuseModel, 'id'> & | 46 | export type VideoAbuseInclude = |
47 | Pick<VideoAbuseModel, 'id'> & | ||
41 | PickWith<VideoAbuseModel, 'Video', VideoInclude> | 48 | PickWith<VideoAbuseModel, 'Video', VideoInclude> |
42 | 49 | ||
43 | export type VideoBlacklistInclude = Pick<VideoBlacklistModel, 'id'> & | 50 | export type VideoBlacklistInclude = |
51 | Pick<VideoBlacklistModel, 'id'> & | ||
44 | PickWith<VideoAbuseModel, 'Video', VideoInclude> | 52 | PickWith<VideoAbuseModel, 'Video', VideoInclude> |
45 | 53 | ||
46 | export type VideoImportInclude = Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> & | 54 | export type VideoImportInclude = |
55 | Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> & | ||
47 | PickWith<VideoImportModel, 'Video', VideoInclude> | 56 | PickWith<VideoImportModel, 'Video', VideoInclude> |
48 | 57 | ||
49 | export type ActorFollower = Pick<ActorModel, 'preferredUsername' | 'getHost'> & | 58 | export type ActorFollower = |
59 | Pick<ActorModel, 'preferredUsername' | 'getHost'> & | ||
50 | PickWith<ActorModel, 'Account', AccountInclude> & | 60 | PickWith<ActorModel, 'Account', AccountInclude> & |
51 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> & | 61 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> & |
52 | PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> | 62 | PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> |
53 | 63 | ||
54 | export type ActorFollowing = Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> & | 64 | export type ActorFollowing = |
65 | Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> & | ||
55 | PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> & | 66 | PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> & |
56 | PickWith<ActorModel, 'Account', AccountInclude> & | 67 | PickWith<ActorModel, 'Account', AccountInclude> & |
57 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> | 68 | PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> |
58 | 69 | ||
59 | export type ActorFollowInclude = Pick<ActorFollowModel, 'id' | 'state'> & | 70 | export type ActorFollowInclude = |
71 | Pick<ActorFollowModel, 'id' | 'state'> & | ||
60 | PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> & | 72 | PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> & |
61 | PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing> | 73 | PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing> |
62 | } | 74 | } |
63 | 75 | ||
64 | // ############################################################################ | 76 | // ############################################################################ |
65 | 77 | ||
66 | export type MUserNotification = Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' | | 78 | export type MUserNotification = |
79 | Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' | | ||
67 | 'VideoImport' | 'Account' | 'ActorFollow'> | 80 | 'VideoImport' | 'Account' | 'ActorFollow'> |
68 | 81 | ||
69 | // ############################################################################ | 82 | // ############################################################################ |
70 | 83 | ||
71 | export type UserNotificationModelForApi = MUserNotification & | 84 | export type UserNotificationModelForApi = |
85 | MUserNotification & | ||
72 | Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & | 86 | Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & |
73 | Use<'Comment', UserNotificationIncludes.VideoCommentInclude> & | 87 | Use<'Comment', UserNotificationIncludes.VideoCommentInclude> & |
74 | Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> & | 88 | Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> & |
diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts index 6ac19c20b..31cf075ef 100644 --- a/server/typings/models/user/user.ts +++ b/server/typings/models/user/user.ts | |||
@@ -29,36 +29,44 @@ export type MUserId = Pick<UserModel, 'id'> | |||
29 | 29 | ||
30 | // With account | 30 | // With account |
31 | 31 | ||
32 | export type MUserAccountId = MUser & | 32 | export type MUserAccountId = |
33 | MUser & | ||
33 | Use<'Account', MAccountId> | 34 | Use<'Account', MAccountId> |
34 | 35 | ||
35 | export type MUserAccountUrl = MUser & | 36 | export type MUserAccountUrl = |
37 | MUser & | ||
36 | Use<'Account', MAccountUrl & MAccountIdActorId> | 38 | Use<'Account', MAccountUrl & MAccountIdActorId> |
37 | 39 | ||
38 | export type MUserAccount = MUser & | 40 | export type MUserAccount = |
41 | MUser & | ||
39 | Use<'Account', MAccount> | 42 | Use<'Account', MAccount> |
40 | 43 | ||
41 | export type MUserAccountDefault = MUser & | 44 | export type MUserAccountDefault = |
45 | MUser & | ||
42 | Use<'Account', MAccountDefault> | 46 | Use<'Account', MAccountDefault> |
43 | 47 | ||
44 | // With channel | 48 | // With channel |
45 | 49 | ||
46 | export type MUserNotifSettingChannelDefault = MUser & | 50 | export type MUserNotifSettingChannelDefault = |
51 | MUser & | ||
47 | Use<'NotificationSetting', MNotificationSetting> & | 52 | Use<'NotificationSetting', MNotificationSetting> & |
48 | Use<'Account', MAccountDefaultChannelDefault> | 53 | Use<'Account', MAccountDefaultChannelDefault> |
49 | 54 | ||
50 | // With notification settings | 55 | // With notification settings |
51 | 56 | ||
52 | export type MUserWithNotificationSetting = MUser & | 57 | export type MUserWithNotificationSetting = |
58 | MUser & | ||
53 | Use<'NotificationSetting', MNotificationSetting> | 59 | Use<'NotificationSetting', MNotificationSetting> |
54 | 60 | ||
55 | export type MUserNotifSettingAccount = MUser & | 61 | export type MUserNotifSettingAccount = |
62 | MUser & | ||
56 | Use<'NotificationSetting', MNotificationSetting> & | 63 | Use<'NotificationSetting', MNotificationSetting> & |
57 | Use<'Account', MAccount> | 64 | Use<'Account', MAccount> |
58 | 65 | ||
59 | // Default scope | 66 | // Default scope |
60 | 67 | ||
61 | export type MUserDefault = MUser & | 68 | export type MUserDefault = |
69 | MUser & | ||
62 | Use<'NotificationSetting', MNotificationSetting> & | 70 | Use<'NotificationSetting', MNotificationSetting> & |
63 | Use<'Account', MAccountDefault> | 71 | Use<'Account', MAccountDefault> |
64 | 72 | ||
@@ -67,12 +75,15 @@ export type MUserDefault = MUser & | |||
67 | // Format for API or AP object | 75 | // Format for API or AP object |
68 | 76 | ||
69 | type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]> | 77 | type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]> |
70 | type MAccountWithChannelsAndSpecialPlaylists = MAccountWithChannels & | 78 | type MAccountWithChannelsAndSpecialPlaylists = |
79 | MAccountWithChannels & | ||
71 | PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]> | 80 | PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]> |
72 | 81 | ||
73 | export type MUserFormattable = MUserQuotaUsed & | 82 | export type MUserFormattable = |
83 | MUserQuotaUsed & | ||
74 | Use<'Account', MAccountWithChannels> & | 84 | Use<'Account', MAccountWithChannels> & |
75 | PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable> | 85 | PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable> |
76 | 86 | ||
77 | export type MMyUserFormattable = MUserFormattable & | 87 | export type MMyUserFormattable = |
88 | MUserFormattable & | ||
78 | Use<'Account', MAccountWithChannelsAndSpecialPlaylists> | 89 | Use<'Account', MAccountWithChannelsAndSpecialPlaylists> |