diff options
Diffstat (limited to 'shared/models')
-rw-r--r-- | shared/models/users/index.ts | 2 | ||||
-rw-r--r-- | shared/models/users/user-notification-setting.model.ts | 13 | ||||
-rw-r--r-- | shared/models/users/user-notification.model.ts | 47 | ||||
-rw-r--r-- | shared/models/users/user.model.ts | 2 |
4 files changed, 64 insertions, 0 deletions
diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts index 7114741e0..cd07cf320 100644 --- a/shared/models/users/index.ts +++ b/shared/models/users/index.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | export * from './user.model' | 1 | export * from './user.model' |
2 | export * from './user-create.model' | 2 | export * from './user-create.model' |
3 | export * from './user-login.model' | 3 | export * from './user-login.model' |
4 | export * from './user-notification.model' | ||
5 | export * from './user-notification-setting.model' | ||
4 | export * from './user-refresh-token.model' | 6 | export * from './user-refresh-token.model' |
5 | export * from './user-update.model' | 7 | export * from './user-update.model' |
6 | export * from './user-update-me.model' | 8 | export * from './user-update-me.model' |
diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts new file mode 100644 index 000000000..7cecd70a2 --- /dev/null +++ b/shared/models/users/user-notification-setting.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | export enum UserNotificationSettingValue { | ||
2 | NONE = 1, | ||
3 | WEB_NOTIFICATION = 2, | ||
4 | EMAIL = 3, | ||
5 | WEB_NOTIFICATION_AND_EMAIL = 4 | ||
6 | } | ||
7 | |||
8 | export interface UserNotificationSetting { | ||
9 | newVideoFromSubscription: UserNotificationSettingValue | ||
10 | newCommentOnMyVideo: UserNotificationSettingValue | ||
11 | videoAbuseAsModerator: UserNotificationSettingValue | ||
12 | blacklistOnMyVideo: UserNotificationSettingValue | ||
13 | } | ||
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts new file mode 100644 index 000000000..39beb2350 --- /dev/null +++ b/shared/models/users/user-notification.model.ts | |||
@@ -0,0 +1,47 @@ | |||
1 | export enum UserNotificationType { | ||
2 | NEW_VIDEO_FROM_SUBSCRIPTION = 1, | ||
3 | NEW_COMMENT_ON_MY_VIDEO = 2, | ||
4 | NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, | ||
5 | BLACKLIST_ON_MY_VIDEO = 4, | ||
6 | UNBLACKLIST_ON_MY_VIDEO = 5 | ||
7 | } | ||
8 | |||
9 | interface VideoInfo { | ||
10 | id: number | ||
11 | uuid: string | ||
12 | name: string | ||
13 | } | ||
14 | |||
15 | export interface UserNotification { | ||
16 | id: number | ||
17 | type: UserNotificationType | ||
18 | read: boolean | ||
19 | |||
20 | video?: VideoInfo & { | ||
21 | channel: { | ||
22 | id: number | ||
23 | displayName: string | ||
24 | } | ||
25 | } | ||
26 | |||
27 | comment?: { | ||
28 | id: number | ||
29 | account: { | ||
30 | id: number | ||
31 | displayName: string | ||
32 | } | ||
33 | } | ||
34 | |||
35 | videoAbuse?: { | ||
36 | id: number | ||
37 | video: VideoInfo | ||
38 | } | ||
39 | |||
40 | videoBlacklist?: { | ||
41 | id: number | ||
42 | video: VideoInfo | ||
43 | } | ||
44 | |||
45 | createdAt: string | ||
46 | updatedAt: string | ||
47 | } | ||
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 2aabff494..af783d389 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts | |||
@@ -2,6 +2,7 @@ import { Account } from '../actors' | |||
2 | import { VideoChannel } from '../videos/channel/video-channel.model' | 2 | import { VideoChannel } from '../videos/channel/video-channel.model' |
3 | import { UserRole } from './user-role' | 3 | import { UserRole } from './user-role' |
4 | import { NSFWPolicyType } from '../videos/nsfw-policy.type' | 4 | import { NSFWPolicyType } from '../videos/nsfw-policy.type' |
5 | import { UserNotificationSetting } from './user-notification-setting.model' | ||
5 | 6 | ||
6 | export interface User { | 7 | export interface User { |
7 | id: number | 8 | id: number |
@@ -19,6 +20,7 @@ export interface User { | |||
19 | videoQuotaDaily: number | 20 | videoQuotaDaily: number |
20 | createdAt: Date | 21 | createdAt: Date |
21 | account: Account | 22 | account: Account |
23 | notificationSettings?: UserNotificationSetting | ||
22 | videoChannels?: VideoChannel[] | 24 | videoChannels?: VideoChannel[] |
23 | 25 | ||
24 | blocked: boolean | 26 | blocked: boolean |