From 2b02c520e66ea452687cab39401b371711caa9ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 May 2021 11:27:40 +0200 Subject: Cleanup shared models --- shared/models/videos/change-ownership/index.ts | 3 ++ .../video-change-ownership-accept.model.ts | 3 ++ .../video-change-ownership-create.model.ts | 3 ++ .../video-change-ownership.model.ts | 17 ++++++++ shared/models/videos/comment/index.ts | 1 + .../models/videos/comment/video-comment.model.ts | 46 ++++++++++++++++++++++ shared/models/videos/index.ts | 12 ++---- .../videos/video-change-ownership-accept.model.ts | 3 -- .../videos/video-change-ownership-create.model.ts | 3 -- .../models/videos/video-change-ownership.model.ts | 17 -------- shared/models/videos/video-comment.model.ts | 46 ---------------------- shared/models/videos/video-file-metadata.model.ts | 13 ++++++ shared/models/videos/video-file-metadata.ts | 13 ------ shared/models/videos/video-file.model.ts | 2 +- 14 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 shared/models/videos/change-ownership/index.ts create mode 100644 shared/models/videos/change-ownership/video-change-ownership-accept.model.ts create mode 100644 shared/models/videos/change-ownership/video-change-ownership-create.model.ts create mode 100644 shared/models/videos/change-ownership/video-change-ownership.model.ts create mode 100644 shared/models/videos/comment/index.ts create mode 100644 shared/models/videos/comment/video-comment.model.ts delete mode 100644 shared/models/videos/video-change-ownership-accept.model.ts delete mode 100644 shared/models/videos/video-change-ownership-create.model.ts delete mode 100644 shared/models/videos/video-change-ownership.model.ts delete mode 100644 shared/models/videos/video-comment.model.ts create mode 100644 shared/models/videos/video-file-metadata.model.ts delete mode 100644 shared/models/videos/video-file-metadata.ts (limited to 'shared/models/videos') diff --git a/shared/models/videos/change-ownership/index.ts b/shared/models/videos/change-ownership/index.ts new file mode 100644 index 000000000..a942fb2cd --- /dev/null +++ b/shared/models/videos/change-ownership/index.ts @@ -0,0 +1,3 @@ +export * from './video-change-ownership-accept.model' +export * from './video-change-ownership-create.model' +export * from './video-change-ownership.model' diff --git a/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts b/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts new file mode 100644 index 000000000..f27247633 --- /dev/null +++ b/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts @@ -0,0 +1,3 @@ +export interface VideoChangeOwnershipAccept { + channelId: number +} diff --git a/shared/models/videos/change-ownership/video-change-ownership-create.model.ts b/shared/models/videos/change-ownership/video-change-ownership-create.model.ts new file mode 100644 index 000000000..40fcca285 --- /dev/null +++ b/shared/models/videos/change-ownership/video-change-ownership-create.model.ts @@ -0,0 +1,3 @@ +export interface VideoChangeOwnershipCreate { + username: string +} diff --git a/shared/models/videos/change-ownership/video-change-ownership.model.ts b/shared/models/videos/change-ownership/video-change-ownership.model.ts new file mode 100644 index 000000000..3d31cad0a --- /dev/null +++ b/shared/models/videos/change-ownership/video-change-ownership.model.ts @@ -0,0 +1,17 @@ +import { Account } from '../../actors' +import { Video } from '../video.model' + +export interface VideoChangeOwnership { + id: number + status: VideoChangeOwnershipStatus + initiatorAccount: Account + nextOwnerAccount: Account + video: Video + createdAt: Date +} + +export const enum VideoChangeOwnershipStatus { + WAITING = 'WAITING', + ACCEPTED = 'ACCEPTED', + REFUSED = 'REFUSED' +} diff --git a/shared/models/videos/comment/index.ts b/shared/models/videos/comment/index.ts new file mode 100644 index 000000000..7b9261a36 --- /dev/null +++ b/shared/models/videos/comment/index.ts @@ -0,0 +1 @@ +export * from './video-comment.model' diff --git a/shared/models/videos/comment/video-comment.model.ts b/shared/models/videos/comment/video-comment.model.ts new file mode 100644 index 000000000..79c0e4c0a --- /dev/null +++ b/shared/models/videos/comment/video-comment.model.ts @@ -0,0 +1,46 @@ +import { Account } from '../../actors' + +export interface VideoComment { + id: number + url: string + text: string + threadId: number + inReplyToCommentId: number + videoId: number + createdAt: Date | string + updatedAt: Date | string + deletedAt: Date | string + isDeleted: boolean + totalRepliesFromVideoAuthor: number + totalReplies: number + account: Account +} + +export interface VideoCommentAdmin { + id: number + url: string + text: string + + threadId: number + inReplyToCommentId: number + + createdAt: Date | string + updatedAt: Date | string + + account: Account + + video: { + id: number + uuid: string + name: string + } +} + +export interface VideoCommentThreadTree { + comment: VideoComment + children: VideoCommentThreadTree[] +} + +export interface VideoCommentCreate { + text: string +} diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index fac3e0b2f..64f2c9df6 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts @@ -1,6 +1,8 @@ export * from './blacklist' export * from './caption' +export * from './change-ownership' export * from './channel' +export * from './comment' export * from './live' export * from './import' export * from './playlist' @@ -10,17 +12,11 @@ export * from './nsfw-policy.type' export * from './thumbnail.type' -export * from './video-change-ownership-accept.model' -export * from './video-change-ownership-create.model' -export * from './video-change-ownership.model' - -export * from './video-comment.model' export * from './video-constant.model' export * from './video-create.model' -export * from './video-file-metadata' -export * from './video-file.model' -export * from './live/live-video.model' +export * from './video-file-metadata.model' +export * from './video-file.model' export * from './video-privacy.enum' export * from './video-query.type' diff --git a/shared/models/videos/video-change-ownership-accept.model.ts b/shared/models/videos/video-change-ownership-accept.model.ts deleted file mode 100644 index f27247633..000000000 --- a/shared/models/videos/video-change-ownership-accept.model.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface VideoChangeOwnershipAccept { - channelId: number -} diff --git a/shared/models/videos/video-change-ownership-create.model.ts b/shared/models/videos/video-change-ownership-create.model.ts deleted file mode 100644 index 40fcca285..000000000 --- a/shared/models/videos/video-change-ownership-create.model.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface VideoChangeOwnershipCreate { - username: string -} diff --git a/shared/models/videos/video-change-ownership.model.ts b/shared/models/videos/video-change-ownership.model.ts deleted file mode 100644 index 669c7f3e7..000000000 --- a/shared/models/videos/video-change-ownership.model.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Account } from '../actors' -import { Video } from './video.model' - -export interface VideoChangeOwnership { - id: number - status: VideoChangeOwnershipStatus - initiatorAccount: Account - nextOwnerAccount: Account - video: Video - createdAt: Date -} - -export const enum VideoChangeOwnershipStatus { - WAITING = 'WAITING', - ACCEPTED = 'ACCEPTED', - REFUSED = 'REFUSED' -} diff --git a/shared/models/videos/video-comment.model.ts b/shared/models/videos/video-comment.model.ts deleted file mode 100644 index 9730a3f76..000000000 --- a/shared/models/videos/video-comment.model.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Account } from '../actors' - -export interface VideoComment { - id: number - url: string - text: string - threadId: number - inReplyToCommentId: number - videoId: number - createdAt: Date | string - updatedAt: Date | string - deletedAt: Date | string - isDeleted: boolean - totalRepliesFromVideoAuthor: number - totalReplies: number - account: Account -} - -export interface VideoCommentAdmin { - id: number - url: string - text: string - - threadId: number - inReplyToCommentId: number - - createdAt: Date | string - updatedAt: Date | string - - account: Account - - video: { - id: number - uuid: string - name: string - } -} - -export interface VideoCommentThreadTree { - comment: VideoComment - children: VideoCommentThreadTree[] -} - -export interface VideoCommentCreate { - text: string -} diff --git a/shared/models/videos/video-file-metadata.model.ts b/shared/models/videos/video-file-metadata.model.ts new file mode 100644 index 000000000..8f527c0a7 --- /dev/null +++ b/shared/models/videos/video-file-metadata.model.ts @@ -0,0 +1,13 @@ +export class VideoFileMetadata { + streams: { [x: string]: any, [x: number]: any }[] + format: { [x: string]: any, [x: number]: any } + chapters: any[] + + constructor (hash: { chapters: any[], format: any, streams: any[] }) { + this.chapters = hash.chapters + this.format = hash.format + this.streams = hash.streams + + delete this.format.filename + } +} diff --git a/shared/models/videos/video-file-metadata.ts b/shared/models/videos/video-file-metadata.ts deleted file mode 100644 index 8f527c0a7..000000000 --- a/shared/models/videos/video-file-metadata.ts +++ /dev/null @@ -1,13 +0,0 @@ -export class VideoFileMetadata { - streams: { [x: string]: any, [x: number]: any }[] - format: { [x: string]: any, [x: number]: any } - chapters: any[] - - constructor (hash: { chapters: any[], format: any, streams: any[] }) { - this.chapters = hash.chapters - this.format = hash.format - this.streams = hash.streams - - delete this.format.filename - } -} diff --git a/shared/models/videos/video-file.model.ts b/shared/models/videos/video-file.model.ts index 1e830b19c..28fce0aaf 100644 --- a/shared/models/videos/video-file.model.ts +++ b/shared/models/videos/video-file.model.ts @@ -1,5 +1,5 @@ import { VideoConstant } from './video-constant.model' -import { VideoFileMetadata } from './video-file-metadata' +import { VideoFileMetadata } from './video-file-metadata.model' import { VideoResolution } from './video-resolution.enum' export interface VideoFile { -- cgit v1.2.3