diff options
Diffstat (limited to 'shared/models/users')
-rw-r--r-- | shared/models/users/index.ts | 2 | ||||
-rw-r--r-- | shared/models/users/user-notification-setting.model.ts | 17 | ||||
-rw-r--r-- | shared/models/users/user-notification.model.ts | 83 | ||||
-rw-r--r-- | shared/models/users/user-right.enum.ts | 9 | ||||
-rw-r--r-- | shared/models/users/user-role.ts | 6 | ||||
-rw-r--r-- | shared/models/users/user-update-me.model.ts | 4 | ||||
-rw-r--r-- | shared/models/users/user-update.model.ts | 2 | ||||
-rw-r--r-- | shared/models/users/user.model.ts | 7 |
8 files changed, 129 insertions, 1 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..531e12bba --- /dev/null +++ b/shared/models/users/user-notification-setting.model.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | export enum UserNotificationSettingValue { | ||
2 | NONE = 0, | ||
3 | WEB = 1 << 0, | ||
4 | EMAIL = 1 << 1 | ||
5 | } | ||
6 | |||
7 | export interface UserNotificationSetting { | ||
8 | newVideoFromSubscription: UserNotificationSettingValue | ||
9 | newCommentOnMyVideo: UserNotificationSettingValue | ||
10 | videoAbuseAsModerator: UserNotificationSettingValue | ||
11 | blacklistOnMyVideo: UserNotificationSettingValue | ||
12 | myVideoPublished: UserNotificationSettingValue | ||
13 | myVideoImportFinished: UserNotificationSettingValue | ||
14 | newUserRegistration: UserNotificationSettingValue | ||
15 | newFollow: UserNotificationSettingValue | ||
16 | commentMention: UserNotificationSettingValue | ||
17 | } | ||
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts new file mode 100644 index 000000000..186b62612 --- /dev/null +++ b/shared/models/users/user-notification.model.ts | |||
@@ -0,0 +1,83 @@ | |||
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 | |||
6 | BLACKLIST_ON_MY_VIDEO = 4, | ||
7 | UNBLACKLIST_ON_MY_VIDEO = 5, | ||
8 | |||
9 | MY_VIDEO_PUBLISHED = 6, | ||
10 | |||
11 | MY_VIDEO_IMPORT_SUCCESS = 7, | ||
12 | MY_VIDEO_IMPORT_ERROR = 8, | ||
13 | |||
14 | NEW_USER_REGISTRATION = 9, | ||
15 | NEW_FOLLOW = 10, | ||
16 | COMMENT_MENTION = 11 | ||
17 | } | ||
18 | |||
19 | export interface VideoInfo { | ||
20 | id: number | ||
21 | uuid: string | ||
22 | name: string | ||
23 | } | ||
24 | |||
25 | export interface ActorInfo { | ||
26 | id: number | ||
27 | displayName: string | ||
28 | name: string | ||
29 | host: string | ||
30 | avatar?: { | ||
31 | path: string | ||
32 | } | ||
33 | } | ||
34 | |||
35 | export interface UserNotification { | ||
36 | id: number | ||
37 | type: UserNotificationType | ||
38 | read: boolean | ||
39 | |||
40 | video?: VideoInfo & { | ||
41 | channel: ActorInfo | ||
42 | } | ||
43 | |||
44 | videoImport?: { | ||
45 | id: number | ||
46 | video?: VideoInfo | ||
47 | torrentName?: string | ||
48 | magnetUri?: string | ||
49 | targetUrl?: string | ||
50 | } | ||
51 | |||
52 | comment?: { | ||
53 | id: number | ||
54 | threadId: number | ||
55 | account: ActorInfo | ||
56 | video: VideoInfo | ||
57 | } | ||
58 | |||
59 | videoAbuse?: { | ||
60 | id: number | ||
61 | video: VideoInfo | ||
62 | } | ||
63 | |||
64 | videoBlacklist?: { | ||
65 | id: number | ||
66 | video: VideoInfo | ||
67 | } | ||
68 | |||
69 | account?: ActorInfo | ||
70 | |||
71 | actorFollow?: { | ||
72 | id: number | ||
73 | follower: ActorInfo | ||
74 | following: { | ||
75 | type: 'account' | 'channel' | ||
76 | name: string | ||
77 | displayName: string | ||
78 | } | ||
79 | } | ||
80 | |||
81 | createdAt: string | ||
82 | updatedAt: string | ||
83 | } | ||
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index c4ccd632f..090256bca 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts | |||
@@ -2,17 +2,26 @@ export enum UserRight { | |||
2 | ALL, | 2 | ALL, |
3 | 3 | ||
4 | MANAGE_USERS, | 4 | MANAGE_USERS, |
5 | |||
5 | MANAGE_SERVER_FOLLOW, | 6 | MANAGE_SERVER_FOLLOW, |
7 | |||
6 | MANAGE_SERVER_REDUNDANCY, | 8 | MANAGE_SERVER_REDUNDANCY, |
9 | |||
7 | MANAGE_VIDEO_ABUSES, | 10 | MANAGE_VIDEO_ABUSES, |
11 | |||
8 | MANAGE_JOBS, | 12 | MANAGE_JOBS, |
13 | |||
9 | MANAGE_CONFIGURATION, | 14 | MANAGE_CONFIGURATION, |
10 | 15 | ||
16 | MANAGE_ACCOUNTS_BLOCKLIST, | ||
17 | MANAGE_SERVERS_BLOCKLIST, | ||
18 | |||
11 | MANAGE_VIDEO_BLACKLIST, | 19 | MANAGE_VIDEO_BLACKLIST, |
12 | 20 | ||
13 | REMOVE_ANY_VIDEO, | 21 | REMOVE_ANY_VIDEO, |
14 | REMOVE_ANY_VIDEO_CHANNEL, | 22 | REMOVE_ANY_VIDEO_CHANNEL, |
15 | REMOVE_ANY_VIDEO_COMMENT, | 23 | REMOVE_ANY_VIDEO_COMMENT, |
16 | UPDATE_ANY_VIDEO, | 24 | UPDATE_ANY_VIDEO, |
25 | SEE_ALL_VIDEOS, | ||
17 | CHANGE_VIDEO_OWNERSHIP | 26 | CHANGE_VIDEO_OWNERSHIP |
18 | } | 27 | } |
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index 552aad999..59c2ba106 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts | |||
@@ -26,7 +26,11 @@ const userRoleRights: { [ id: number ]: UserRight[] } = { | |||
26 | UserRight.REMOVE_ANY_VIDEO, | 26 | UserRight.REMOVE_ANY_VIDEO, |
27 | UserRight.REMOVE_ANY_VIDEO_CHANNEL, | 27 | UserRight.REMOVE_ANY_VIDEO_CHANNEL, |
28 | UserRight.REMOVE_ANY_VIDEO_COMMENT, | 28 | UserRight.REMOVE_ANY_VIDEO_COMMENT, |
29 | UserRight.UPDATE_ANY_VIDEO | 29 | UserRight.UPDATE_ANY_VIDEO, |
30 | UserRight.SEE_ALL_VIDEOS, | ||
31 | UserRight.MANAGE_ACCOUNTS_BLOCKLIST, | ||
32 | UserRight.MANAGE_SERVERS_BLOCKLIST, | ||
33 | UserRight.MANAGE_USERS | ||
30 | ], | 34 | ], |
31 | 35 | ||
32 | [UserRole.USER]: [] | 36 | [UserRole.USER]: [] |
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index bbffe1487..e24afab94 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts | |||
@@ -4,7 +4,11 @@ export interface UserUpdateMe { | |||
4 | displayName?: string | 4 | displayName?: string |
5 | description?: string | 5 | description?: string |
6 | nsfwPolicy?: NSFWPolicyType | 6 | nsfwPolicy?: NSFWPolicyType |
7 | |||
8 | webTorrentEnabled?: boolean | ||
7 | autoPlayVideo?: boolean | 9 | autoPlayVideo?: boolean |
10 | videosHistoryEnabled?: boolean | ||
11 | |||
8 | email?: string | 12 | email?: string |
9 | currentPassword?: string | 13 | currentPassword?: string |
10 | password?: string | 14 | password?: string |
diff --git a/shared/models/users/user-update.model.ts b/shared/models/users/user-update.model.ts index ce866fb18..cd215bab3 100644 --- a/shared/models/users/user-update.model.ts +++ b/shared/models/users/user-update.model.ts | |||
@@ -1,7 +1,9 @@ | |||
1 | import { UserRole } from './user-role' | 1 | import { UserRole } from './user-role' |
2 | 2 | ||
3 | export interface UserUpdate { | 3 | export interface UserUpdate { |
4 | password?: string | ||
4 | email?: string | 5 | email?: string |
6 | emailVerified?: boolean | ||
5 | videoQuota?: number | 7 | videoQuota?: number |
6 | videoQuotaDaily?: number | 8 | videoQuotaDaily?: number |
7 | role?: UserRole | 9 | role?: UserRole |
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 8147dc48e..af783d389 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts | |||
@@ -2,18 +2,25 @@ 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 |
8 | username: string | 9 | username: string |
9 | email: string | 10 | email: string |
11 | emailVerified: boolean | ||
10 | nsfwPolicy: NSFWPolicyType | 12 | nsfwPolicy: NSFWPolicyType |
13 | |||
11 | autoPlayVideo: boolean | 14 | autoPlayVideo: boolean |
15 | webTorrentEnabled: boolean | ||
16 | videosHistoryEnabled: boolean | ||
17 | |||
12 | role: UserRole | 18 | role: UserRole |
13 | videoQuota: number | 19 | videoQuota: number |
14 | videoQuotaDaily: number | 20 | videoQuotaDaily: number |
15 | createdAt: Date | 21 | createdAt: Date |
16 | account: Account | 22 | account: Account |
23 | notificationSettings?: UserNotificationSetting | ||
17 | videoChannels?: VideoChannel[] | 24 | videoChannels?: VideoChannel[] |
18 | 25 | ||
19 | blocked: boolean | 26 | blocked: boolean |