From 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 21 Jun 2022 15:31:25 +0200 Subject: store uploaded video filename (#4885) * store uploaded video filename closes #4731 * dont crash if videos channel exist * migration: use raw query * video source: fixes after code review * cleanup * bump migration * updates after code review * refactor: use checkUserCanManageVideo * videoSource: add openapi doc * test(check-params/video-source): fix timeout * Styling * Correctly set original filename as source Co-authored-by: Chocobozzz --- shared/models/videos/video-source.ts | 3 +++ shared/server-commands/videos/videos-command.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 shared/models/videos/video-source.ts (limited to 'shared') diff --git a/shared/models/videos/video-source.ts b/shared/models/videos/video-source.ts new file mode 100644 index 000000000..57e54fc7f --- /dev/null +++ b/shared/models/videos/video-source.ts @@ -0,0 +1,3 @@ +export interface VideoSource { + filename: string +} diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index 1cceb58db..e952c9777 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts @@ -23,6 +23,7 @@ import { import { unwrapBody } from '../requests' import { waitJobs } from '../server' import { AbstractCommand, OverrideCommandOptions } from '../shared' +import { VideoSource } from '@shared/models/videos/video-source' export type VideoEdit = Partial> & { fixture?: string @@ -150,6 +151,20 @@ export class VideosCommand extends AbstractCommand { }) } + getSource (options: OverrideCommandOptions & { + id: number | string + }) { + const path = '/api/v1/videos/' + options.id + '/source' + + return this.getRequestBody({ + ...options, + + path, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) + } + async getId (options: OverrideCommandOptions & { uuid: number | string }) { -- cgit v1.2.3