aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/pods
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/models/pods
parent7a214f746bf420defbf17fa218d90d6233551bf8 (diff)
downloadPeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.tar.gz
PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.tar.zst
PeerTube-4771e0008dd26eadbb7eaff64255a6ec914fdadb.zip
Better typescript typing for a better world
Diffstat (limited to 'shared/models/pods')
-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.ts7
-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
11 files changed, 118 insertions, 0 deletions
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/pods/pod.model.ts b/shared/models/pods/pod.model.ts
new file mode 100644
index 000000000..d25421936
--- /dev/null
+++ b/shared/models/pods/pod.model.ts
@@ -0,0 +1,7 @@
1export interface Pod {
2 id: number,
3 host: string,
4 email: string,
5 score: number,
6 createdAt: Date
7}
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}