From d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 28 Jun 2021 17:30:59 +0200 Subject: Support short uuid for GET video/playlist --- server/models/video/formatter/video-format-utils.ts | 3 +++ server/models/video/video-caption.ts | 4 ++-- server/models/video/video-playlist.ts | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'server/models') diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts index 8880c0450..672c671b8 100644 --- a/server/models/video/formatter/video-format-utils.ts +++ b/server/models/video/formatter/video-format-utils.ts @@ -1,3 +1,4 @@ +import { uuidToShort } from '@server/helpers/uuid' import { generateMagnetUri } from '@server/helpers/webtorrent' import { getLocalVideoFileMetadataUrl } from '@server/lib/video-paths' import { VideoFile } from '@shared/models/videos/video-file.model' @@ -47,6 +48,8 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFor const videoObject: Video = { id: video.id, uuid: video.uuid, + shortUUID: uuidToShort(video.uuid), + name: video.name, category: { id: video.category, diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 5ec944b9e..d24be56c3 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -15,7 +15,7 @@ import { Table, UpdatedAt } from 'sequelize-typescript' -import { v4 as uuidv4 } from 'uuid' +import { buildUUID } from '@server/helpers/uuid' import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models' import { AttributesOnly } from '@shared/core-utils' import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' @@ -182,7 +182,7 @@ export class VideoCaptionModel extends Model