aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/users/user-notification.model.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-31 14:34:36 +0200
committerChocobozzz <me@florianbigard.com>2023-08-11 15:02:33 +0200
commit3a4992633ee62d5edfbb484d9c6bcb3cf158489d (patch)
treee4510b39bdac9c318fdb4b47018d08f15368b8f0 /shared/models/users/user-notification.model.ts
parent04d1da5621d25d59bd5fa1543b725c497bf5d9a8 (diff)
downloadPeerTube-3a4992633ee62d5edfbb484d9c6bcb3cf158489d.tar.gz
PeerTube-3a4992633ee62d5edfbb484d9c6bcb3cf158489d.tar.zst
PeerTube-3a4992633ee62d5edfbb484d9c6bcb3cf158489d.zip
Migrate server to ESM
Sorry for the very big commit that may lead to git log issues and merge conflicts, but it's a major step forward: * Server can be faster at startup because imports() are async and we can easily lazy import big modules * Angular doesn't seem to support ES import (with .js extension), so we had to correctly organize peertube into a monorepo: * Use yarn workspace feature * Use typescript reference projects for dependencies * Shared projects have been moved into "packages", each one is now a node module (with a dedicated package.json/tsconfig.json) * server/tools have been moved into apps/ and is now a dedicated app bundled and published on NPM so users don't have to build peertube cli tools manually * server/tests have been moved into packages/ so we don't compile them every time we want to run the server * Use isolatedModule option: * Had to move from const enum to const (https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums) * Had to explictely specify "type" imports when used in decorators * Prefer tsx (that uses esbuild under the hood) instead of ts-node to load typescript files (tests with mocha or scripts): * To reduce test complexity as esbuild doesn't support decorator metadata, we only test server files that do not import server models * We still build tests files into js files for a faster CI * Remove unmaintained peertube CLI import script * Removed some barrels to speed up execution (less imports)
Diffstat (limited to 'shared/models/users/user-notification.model.ts')
-rw-r--r--shared/models/users/user-notification.model.ts138
1 files changed, 0 insertions, 138 deletions
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts
deleted file mode 100644
index 294c921bd..000000000
--- a/shared/models/users/user-notification.model.ts
+++ /dev/null
@@ -1,138 +0,0 @@
1import { FollowState } from '../actors'
2import { AbuseState } from '../moderation'
3import { PluginType } from '../plugins'
4
5export const enum UserNotificationType {
6 NEW_VIDEO_FROM_SUBSCRIPTION = 1,
7 NEW_COMMENT_ON_MY_VIDEO = 2,
8 NEW_ABUSE_FOR_MODERATORS = 3,
9
10 BLACKLIST_ON_MY_VIDEO = 4,
11 UNBLACKLIST_ON_MY_VIDEO = 5,
12
13 MY_VIDEO_PUBLISHED = 6,
14
15 MY_VIDEO_IMPORT_SUCCESS = 7,
16 MY_VIDEO_IMPORT_ERROR = 8,
17
18 NEW_USER_REGISTRATION = 9,
19 NEW_FOLLOW = 10,
20 COMMENT_MENTION = 11,
21
22 VIDEO_AUTO_BLACKLIST_FOR_MODERATORS = 12,
23
24 NEW_INSTANCE_FOLLOWER = 13,
25
26 AUTO_INSTANCE_FOLLOWING = 14,
27
28 ABUSE_STATE_CHANGE = 15,
29
30 ABUSE_NEW_MESSAGE = 16,
31
32 NEW_PLUGIN_VERSION = 17,
33 NEW_PEERTUBE_VERSION = 18,
34
35 MY_VIDEO_STUDIO_EDITION_FINISHED = 19,
36
37 NEW_USER_REGISTRATION_REQUEST = 20
38}
39
40export interface VideoInfo {
41 id: number
42 uuid: string
43 shortUUID: string
44 name: string
45}
46
47export interface AvatarInfo {
48 width: number
49 path: string
50}
51
52export interface ActorInfo {
53 id: number
54 displayName: string
55 name: string
56 host: string
57
58 avatars: AvatarInfo[]
59 avatar: AvatarInfo
60}
61
62export interface UserNotification {
63 id: number
64 type: UserNotificationType
65 read: boolean
66
67 video?: VideoInfo & {
68 channel: ActorInfo
69 }
70
71 videoImport?: {
72 id: number
73 video?: VideoInfo
74 torrentName?: string
75 magnetUri?: string
76 targetUrl?: string
77 }
78
79 comment?: {
80 id: number
81 threadId: number
82 account: ActorInfo
83 video: VideoInfo
84 }
85
86 abuse?: {
87 id: number
88 state: AbuseState
89
90 video?: VideoInfo
91
92 comment?: {
93 threadId: number
94
95 video: VideoInfo
96 }
97
98 account?: ActorInfo
99 }
100
101 videoBlacklist?: {
102 id: number
103 video: VideoInfo
104 }
105
106 account?: ActorInfo
107
108 actorFollow?: {
109 id: number
110 follower: ActorInfo
111 state: FollowState
112
113 following: {
114 type: 'account' | 'channel' | 'instance'
115 name: string
116 displayName: string
117 host: string
118 }
119 }
120
121 plugin?: {
122 name: string
123 type: PluginType
124 latestVersion: string
125 }
126
127 peertube?: {
128 latestVersion: string
129 }
130
131 registration?: {
132 id: number
133 username: string
134 }
135
136 createdAt: string
137 updatedAt: string
138}