aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-10 19:43:21 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-10 19:43:21 +0200
commit4771e0008dd26eadbb7eaff64255a6ec914fdadb (patch)
tree4fd58f8a3f3c2d674b936c99817b4f5fb958c5d8 /shared
parent7a214f746bf420defbf17fa218d90d6233551bf8 (diff)
downloadPeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.tar.gz
PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.tar.zst
PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.zip
Better typescript typing for a better world
Diffstat (limited to 'shared')
-rw-r--r--shared/models/index.ts9
-rw-r--r--shared/models/pods/index.ts3
-rw-r--r--shared/models/pods/pod-signature.model.ts4
-rw-r--r--shared/models/pods/pod.model.ts (renamed from shared/models/pod.model.ts)0
-rw-r--r--shared/models/pods/remote-video/index.ts7
-rw-r--r--shared/models/pods/remote-video/remote-qadu-video-request.model.ts10
-rw-r--r--shared/models/pods/remote-video/remote-video-create-request.model.ts27
-rw-r--r--shared/models/pods/remote-video/remote-video-event-request.model.ts11
-rw-r--r--shared/models/pods/remote-video/remote-video-remove-request.model.ts10
-rw-r--r--shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts12
-rw-r--r--shared/models/pods/remote-video/remote-video-request.model.ts4
-rw-r--r--shared/models/pods/remote-video/remote-video-update-request.model.ts23
-rw-r--r--shared/models/user-video-rate.model.ts7
-rw-r--r--shared/models/users/index.ts4
-rw-r--r--shared/models/users/user-create.model.ts5
-rw-r--r--shared/models/users/user-role.type.ts1
-rw-r--r--shared/models/users/user-update.model.ts4
-rw-r--r--shared/models/users/user.model.ts (renamed from shared/models/user.model.ts)2
-rw-r--r--shared/models/videos/index.ts10
-rw-r--r--shared/models/videos/user-video-rate-update.model.ts5
-rw-r--r--shared/models/videos/user-video-rate.model.ts6
-rw-r--r--shared/models/videos/user-video-rate.type.ts1
-rw-r--r--shared/models/videos/video-abuse-create.model.ts3
-rw-r--r--shared/models/videos/video-abuse.model.ts (renamed from shared/models/video-abuse.model.ts)0
-rw-r--r--shared/models/videos/video-blacklist.model.ts (renamed from shared/models/video-blacklist.model.ts)0
-rw-r--r--shared/models/videos/video-create.model.ts9
-rw-r--r--shared/models/videos/video-rate.type.ts1
-rw-r--r--shared/models/videos/video-update.model.ts9
-rw-r--r--shared/models/videos/video.model.ts (renamed from shared/models/video.model.ts)0
29 files changed, 173 insertions, 14 deletions
diff --git a/shared/models/index.ts b/shared/models/index.ts
index cd885af89..02665a3e6 100644
--- a/shared/models/index.ts
+++ b/shared/models/index.ts
@@ -1,11 +1,8 @@
1export * from './pods'
2export * from './users'
3export * from './videos'
1export * from './job.model' 4export * from './job.model'
2export * from './oauth-client-local.model' 5export * from './oauth-client-local.model'
3export * from './pod.model'
4export * from './result-list.model' 6export * from './result-list.model'
5export * from './request-scheduler.model' 7export * from './request-scheduler.model'
6export * from './user-video-rate.model'
7export * from './user.model'
8export * from './video-abuse.model'
9export * from './video-blacklist.model'
10export * from './video.model'
11export * from './server-config.model' 8export * from './server-config.model'
diff --git a/shared/models/pods/index.ts b/shared/models/pods/index.ts
new file mode 100644
index 000000000..f59d01540
--- /dev/null
+++ b/shared/models/pods/index.ts
@@ -0,0 +1,3 @@
1export * from './pod-signature.model'
2export * from './pod.model'
3export * from './remote-video'
diff --git a/shared/models/pods/pod-signature.model.ts b/shared/models/pods/pod-signature.model.ts
new file mode 100644
index 000000000..b7988a40c
--- /dev/null
+++ b/shared/models/pods/pod-signature.model.ts
@@ -0,0 +1,4 @@
1export interface PodSignature {
2 host: string
3 signature: string
4}
diff --git a/shared/models/pod.model.ts b/shared/models/pods/pod.model.ts
index d25421936..d25421936 100644
--- a/shared/models/pod.model.ts
+++ b/shared/models/pods/pod.model.ts
diff --git a/shared/models/pods/remote-video/index.ts b/shared/models/pods/remote-video/index.ts
new file mode 100644
index 000000000..c88116849
--- /dev/null
+++ b/shared/models/pods/remote-video/index.ts
@@ -0,0 +1,7 @@
1export * from './remote-qadu-video-request.model'
2export * from './remote-video-event-request.model'
3export * from './remote-video-request.model'
4export * from './remote-video-create-request.model'
5export * from './remote-video-update-request.model'
6export * from './remote-video-remove-request.model'
7export * from './remote-video-report-abuse-request.model'
diff --git a/shared/models/pods/remote-video/remote-qadu-video-request.model.ts b/shared/models/pods/remote-video/remote-qadu-video-request.model.ts
new file mode 100644
index 000000000..0f84e3f13
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-qadu-video-request.model.ts
@@ -0,0 +1,10 @@
1export interface RemoteQaduVideoData {
2 remoteId: string
3 views?: number
4 likes?: number
5 dislikes?: number
6}
7
8export interface RemoteQaduVideoRequest {
9 data: RemoteQaduVideoData
10}
diff --git a/shared/models/pods/remote-video/remote-video-create-request.model.ts b/shared/models/pods/remote-video/remote-video-create-request.model.ts
new file mode 100644
index 000000000..6babb0083
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-video-create-request.model.ts
@@ -0,0 +1,27 @@
1import { RemoteVideoRequest } from './remote-video-request.model'
2
3export interface RemoteVideoCreateData {
4 remoteId: string
5 author: string
6 tags: string[]
7 name: string
8 extname: string
9 infoHash: string
10 category: number
11 licence: number
12 language: number
13 nsfw: boolean
14 description: string
15 duration: number
16 createdAt: Date
17 updatedAt: Date
18 views: number
19 likes: number
20 dislikes: number
21 thumbnailData: string
22}
23
24export interface RemoteVideoCreateRequest extends RemoteVideoRequest {
25 type: 'add'
26 data: RemoteVideoCreateData
27}
diff --git a/shared/models/pods/remote-video/remote-video-event-request.model.ts b/shared/models/pods/remote-video/remote-video-event-request.model.ts
new file mode 100644
index 000000000..84df1ca2f
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-video-event-request.model.ts
@@ -0,0 +1,11 @@
1export type RemoteVideoEventType = 'views' | 'likes' | 'dislikes'
2
3export interface RemoteVideoEventData {
4 remoteId: string
5 eventType: RemoteVideoEventType
6 count: number
7}
8
9export interface RemoteVideoEventRequest {
10 data: RemoteVideoEventData
11}
diff --git a/shared/models/pods/remote-video/remote-video-remove-request.model.ts b/shared/models/pods/remote-video/remote-video-remove-request.model.ts
new file mode 100644
index 000000000..95ee38661
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-video-remove-request.model.ts
@@ -0,0 +1,10 @@
1import { RemoteVideoRequest } from './remote-video-request.model'
2
3export interface RemoteVideoRemoveData {
4 remoteId: string
5}
6
7export interface RemoteVideoRemoveRequest extends RemoteVideoRequest {
8 type: 'remove'
9 data: RemoteVideoRemoveData
10}
diff --git a/shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts b/shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts
new file mode 100644
index 000000000..9059c92e0
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-video-report-abuse-request.model.ts
@@ -0,0 +1,12 @@
1import { RemoteVideoRequest } from './remote-video-request.model'
2
3export interface RemoteVideoReportAbuseData {
4 videoRemoteId: string
5 reporterUsername: string
6 reportReason: string
7}
8
9export interface RemoteVideoReportAbuseRequest extends RemoteVideoRequest {
10 type: 'report-abuse'
11 data: RemoteVideoReportAbuseData
12}
diff --git a/shared/models/pods/remote-video/remote-video-request.model.ts b/shared/models/pods/remote-video/remote-video-request.model.ts
new file mode 100644
index 000000000..e5052a23d
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-video-request.model.ts
@@ -0,0 +1,4 @@
1export interface RemoteVideoRequest {
2 type: 'add' | 'update' | 'remove' | 'report-abuse'
3 data: any
4}
diff --git a/shared/models/pods/remote-video/remote-video-update-request.model.ts b/shared/models/pods/remote-video/remote-video-update-request.model.ts
new file mode 100644
index 000000000..67ddbc1e4
--- /dev/null
+++ b/shared/models/pods/remote-video/remote-video-update-request.model.ts
@@ -0,0 +1,23 @@
1export interface RemoteVideoUpdateData {
2 remoteId: string
3 tags: string[]
4 name: string
5 extname: string
6 infoHash: string
7 category: number
8 licence: number
9 language: number
10 nsfw: boolean
11 description: string
12 duration: number
13 createdAt: Date
14 updatedAt: Date
15 views: number
16 likes: number
17 dislikes: number
18}
19
20export interface RemoteVideoUpdateRequest {
21 type: 'update'
22 data: RemoteVideoUpdateData
23}
diff --git a/shared/models/user-video-rate.model.ts b/shared/models/user-video-rate.model.ts
deleted file mode 100644
index b770f4073..000000000
--- a/shared/models/user-video-rate.model.ts
+++ /dev/null
@@ -1,7 +0,0 @@
1export type VideoRateType = 'like' | 'dislike'
2export type UserVideoRateType = 'like' | 'dislike' | 'none'
3
4export interface UserVideoRate {
5 videoId: string
6 rating: UserVideoRateType
7}
diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts
new file mode 100644
index 000000000..414aaab08
--- /dev/null
+++ b/shared/models/users/index.ts
@@ -0,0 +1,4 @@
1export * from './user.model'
2export * from './user-create.model'
3export * from './user-update.model'
4export * from './user-role.type'
diff --git a/shared/models/users/user-create.model.ts b/shared/models/users/user-create.model.ts
new file mode 100644
index 000000000..2cddcdcb0
--- /dev/null
+++ b/shared/models/users/user-create.model.ts
@@ -0,0 +1,5 @@
1export interface UserCreate {
2 username: string
3 password: string
4 email: string
5}
diff --git a/shared/models/users/user-role.type.ts b/shared/models/users/user-role.type.ts
new file mode 100644
index 000000000..b38c4c8c3
--- /dev/null
+++ b/shared/models/users/user-role.type.ts
@@ -0,0 +1 @@
export type UserRole = 'admin' | 'user'
diff --git a/shared/models/users/user-update.model.ts b/shared/models/users/user-update.model.ts
new file mode 100644
index 000000000..8b9abfb15
--- /dev/null
+++ b/shared/models/users/user-update.model.ts
@@ -0,0 +1,4 @@
1export interface UserUpdate {
2 displayNSFW?: boolean
3 password?: string
4}
diff --git a/shared/models/user.model.ts b/shared/models/users/user.model.ts
index 92dc73ec2..5c48a17b2 100644
--- a/shared/models/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -1,4 +1,4 @@
1export type UserRole = 'admin' | 'user' 1import { UserRole } from './user-role.type'
2 2
3export interface User { 3export interface User {
4 id: number 4 id: number
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts
new file mode 100644
index 000000000..64d1676c5
--- /dev/null
+++ b/shared/models/videos/index.ts
@@ -0,0 +1,10 @@
1export * from './user-video-rate-update.model'
2export * from './user-video-rate.model'
3export * from './user-video-rate.type'
4export * from './video-abuse-create.model'
5export * from './video-abuse.model'
6export * from './video-blacklist.model'
7export * from './video-create.model'
8export * from './video-rate.type'
9export * from './video-update.model'
10export * from './video.model'
diff --git a/shared/models/videos/user-video-rate-update.model.ts b/shared/models/videos/user-video-rate-update.model.ts
new file mode 100644
index 000000000..85e89271a
--- /dev/null
+++ b/shared/models/videos/user-video-rate-update.model.ts
@@ -0,0 +1,5 @@
1import { UserVideoRateType } from './user-video-rate.type'
2
3export interface UserVideoRateUpdate {
4 rating: UserVideoRateType
5}
diff --git a/shared/models/videos/user-video-rate.model.ts b/shared/models/videos/user-video-rate.model.ts
new file mode 100644
index 000000000..4b9c574d8
--- /dev/null
+++ b/shared/models/videos/user-video-rate.model.ts
@@ -0,0 +1,6 @@
1import { UserVideoRateType } from './user-video-rate.type'
2
3export interface UserVideoRate {
4 videoId: string
5 rating: UserVideoRateType
6}
diff --git a/shared/models/videos/user-video-rate.type.ts b/shared/models/videos/user-video-rate.type.ts
new file mode 100644
index 000000000..a4d9c7e39
--- /dev/null
+++ b/shared/models/videos/user-video-rate.type.ts
@@ -0,0 +1 @@
export type UserVideoRateType = 'like' | 'dislike' | 'none'
diff --git a/shared/models/videos/video-abuse-create.model.ts b/shared/models/videos/video-abuse-create.model.ts
new file mode 100644
index 000000000..db6458275
--- /dev/null
+++ b/shared/models/videos/video-abuse-create.model.ts
@@ -0,0 +1,3 @@
1export interface VideoAbuseCreate {
2 reason: string
3}
diff --git a/shared/models/video-abuse.model.ts b/shared/models/videos/video-abuse.model.ts
index 72e32cbc7..72e32cbc7 100644
--- a/shared/models/video-abuse.model.ts
+++ b/shared/models/videos/video-abuse.model.ts
diff --git a/shared/models/video-blacklist.model.ts b/shared/models/videos/video-blacklist.model.ts
index f894bb065..f894bb065 100644
--- a/shared/models/video-blacklist.model.ts
+++ b/shared/models/videos/video-blacklist.model.ts
diff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.ts
new file mode 100644
index 000000000..5c0b498ce
--- /dev/null
+++ b/shared/models/videos/video-create.model.ts
@@ -0,0 +1,9 @@
1export interface VideoCreate {
2 category: number
3 licence: number
4 language: number
5 description: string
6 nsfw: boolean
7 name: string
8 tags: string[]
9}
diff --git a/shared/models/videos/video-rate.type.ts b/shared/models/videos/video-rate.type.ts
new file mode 100644
index 000000000..d48774a4b
--- /dev/null
+++ b/shared/models/videos/video-rate.type.ts
@@ -0,0 +1 @@
export type VideoRateType = 'like' | 'dislike'
diff --git a/shared/models/videos/video-update.model.ts b/shared/models/videos/video-update.model.ts
new file mode 100644
index 000000000..29a82621b
--- /dev/null
+++ b/shared/models/videos/video-update.model.ts
@@ -0,0 +1,9 @@
1export interface VideoUpdate {
2 name?: string
3 category?: number
4 licence?: number
5 language?: number
6 description?: string
7 tags?: string[]
8 nsfw?: boolean
9}
diff --git a/shared/models/video.model.ts b/shared/models/videos/video.model.ts
index 2e35f005c..2e35f005c 100644
--- a/shared/models/video.model.ts
+++ b/shared/models/videos/video.model.ts