From d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Mon, 28 Jun 2021 17:30:59 +0200
Subject: Support short uuid for GET video/playlist

---
 shared/models/common/index.ts                              |  1 +
 shared/models/common/result-list.model.ts                  |  8 ++++++++
 shared/models/index.ts                                     | 14 +++++++-------
 shared/models/moderation/abuse/abuse-create.model.ts       |  2 +-
 shared/models/oauth-client-local.model.ts                  |  4 ----
 shared/models/result-list.model.ts                         |  8 --------
 shared/models/tokens/index.ts                              |  1 +
 shared/models/tokens/oauth-client-local.model.ts           |  4 ++++
 shared/models/videos/index.ts                              |  1 +
 shared/models/videos/playlist/index.ts                     |  1 +
 .../videos/playlist/video-playlist-create-result.model.ts  |  5 +++++
 shared/models/videos/playlist/video-playlist.model.ts      |  2 ++
 shared/models/videos/video-create-result.model.ts          |  5 +++++
 shared/models/videos/video.model.ts                        |  2 ++
 14 files changed, 38 insertions(+), 20 deletions(-)
 create mode 100644 shared/models/common/index.ts
 create mode 100644 shared/models/common/result-list.model.ts
 delete mode 100644 shared/models/oauth-client-local.model.ts
 delete mode 100644 shared/models/result-list.model.ts
 create mode 100644 shared/models/tokens/index.ts
 create mode 100644 shared/models/tokens/oauth-client-local.model.ts
 create mode 100644 shared/models/videos/playlist/video-playlist-create-result.model.ts
 create mode 100644 shared/models/videos/video-create-result.model.ts

(limited to 'shared/models')

diff --git a/shared/models/common/index.ts b/shared/models/common/index.ts
new file mode 100644
index 000000000..4db85eff2
--- /dev/null
+++ b/shared/models/common/index.ts
@@ -0,0 +1 @@
+export * from './result-list.model'
diff --git a/shared/models/common/result-list.model.ts b/shared/models/common/result-list.model.ts
new file mode 100644
index 000000000..fcafcfb2f
--- /dev/null
+++ b/shared/models/common/result-list.model.ts
@@ -0,0 +1,8 @@
+export interface ResultList<T> {
+  total: number
+  data: T[]
+}
+
+export interface ThreadsResultList <T> extends ResultList <T> {
+  totalNotDeletedComments: number
+}
diff --git a/shared/models/index.ts b/shared/models/index.ts
index 4db1f234e..5c2bc480e 100644
--- a/shared/models/index.ts
+++ b/shared/models/index.ts
@@ -1,16 +1,16 @@
 export * from './activitypub'
 export * from './actors'
-export * from './moderation'
-export * from './custom-markup'
 export * from './bulk'
-export * from './redundancy'
-export * from './users'
-export * from './videos'
+export * from './common'
+export * from './custom-markup'
 export * from './feeds'
 export * from './joinpeertube'
+export * from './moderation'
 export * from './overviews'
 export * from './plugins'
+export * from './redundancy'
 export * from './search'
 export * from './server'
-export * from './oauth-client-local.model'
-export * from './result-list.model'
+export * from './tokens'
+export * from './users'
+export * from './videos'
diff --git a/shared/models/moderation/abuse/abuse-create.model.ts b/shared/models/moderation/abuse/abuse-create.model.ts
index 0e7e9587f..7d35555c3 100644
--- a/shared/models/moderation/abuse/abuse-create.model.ts
+++ b/shared/models/moderation/abuse/abuse-create.model.ts
@@ -10,7 +10,7 @@ export interface AbuseCreate {
   }
 
   video?: {
-    id: number
+    id: number | string
     startAt?: number
     endAt?: number
   }
diff --git a/shared/models/oauth-client-local.model.ts b/shared/models/oauth-client-local.model.ts
deleted file mode 100644
index 0c6ce6c5d..000000000
--- a/shared/models/oauth-client-local.model.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface OAuthClientLocal {
-  client_id: string
-  client_secret: string
-}
diff --git a/shared/models/result-list.model.ts b/shared/models/result-list.model.ts
deleted file mode 100644
index fcafcfb2f..000000000
--- a/shared/models/result-list.model.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export interface ResultList<T> {
-  total: number
-  data: T[]
-}
-
-export interface ThreadsResultList <T> extends ResultList <T> {
-  totalNotDeletedComments: number
-}
diff --git a/shared/models/tokens/index.ts b/shared/models/tokens/index.ts
new file mode 100644
index 000000000..fe130f153
--- /dev/null
+++ b/shared/models/tokens/index.ts
@@ -0,0 +1 @@
+export * from './oauth-client-local.model'
diff --git a/shared/models/tokens/oauth-client-local.model.ts b/shared/models/tokens/oauth-client-local.model.ts
new file mode 100644
index 000000000..0c6ce6c5d
--- /dev/null
+++ b/shared/models/tokens/oauth-client-local.model.ts
@@ -0,0 +1,4 @@
+export interface OAuthClientLocal {
+  client_id: string
+  client_secret: string
+}
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts
index 64f2c9df6..faa9b9868 100644
--- a/shared/models/videos/index.ts
+++ b/shared/models/videos/index.ts
@@ -35,3 +35,4 @@ export * from './video-transcoding-fps.model'
 
 export * from './video-update.model'
 export * from './video.model'
+export * from './video-create-result.model'
diff --git a/shared/models/videos/playlist/index.ts b/shared/models/videos/playlist/index.ts
index 99f7e9bab..f11a4bd28 100644
--- a/shared/models/videos/playlist/index.ts
+++ b/shared/models/videos/playlist/index.ts
@@ -1,4 +1,5 @@
 export * from './video-exist-in-playlist.model'
+export * from './video-playlist-create-result.model'
 export * from './video-playlist-create.model'
 export * from './video-playlist-element-create.model'
 export * from './video-playlist-element-update.model'
diff --git a/shared/models/videos/playlist/video-playlist-create-result.model.ts b/shared/models/videos/playlist/video-playlist-create-result.model.ts
new file mode 100644
index 000000000..cd9b170ae
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-create-result.model.ts
@@ -0,0 +1,5 @@
+export interface VideoPlaylistCreateResult {
+  id: number
+  uuid: string
+  shortUUID: string
+}
diff --git a/shared/models/videos/playlist/video-playlist.model.ts b/shared/models/videos/playlist/video-playlist.model.ts
index ab4171ad1..b8a9955d9 100644
--- a/shared/models/videos/playlist/video-playlist.model.ts
+++ b/shared/models/videos/playlist/video-playlist.model.ts
@@ -6,6 +6,8 @@ import { VideoPlaylistType } from './video-playlist-type.model'
 export interface VideoPlaylist {
   id: number
   uuid: string
+  shortUUID: string
+
   isLocal: boolean
 
   url: string
diff --git a/shared/models/videos/video-create-result.model.ts b/shared/models/videos/video-create-result.model.ts
new file mode 100644
index 000000000..a9f8e25a0
--- /dev/null
+++ b/shared/models/videos/video-create-result.model.ts
@@ -0,0 +1,5 @@
+export interface VideoCreateResult {
+  id: number
+  uuid: string
+  shortUUID: string
+}
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index caefeff82..0e3e89f43 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -10,6 +10,8 @@ import { VideoStreamingPlaylist } from './video-streaming-playlist.model'
 export interface Video {
   id: number
   uuid: string
+  shortUUID: string
+
   createdAt: Date | string
   updatedAt: Date | string
   publishedAt: Date | string
-- 
cgit v1.2.3