From fbd67e7f386504e50f2504cb6386700a58906f16 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Jul 2021 16:40:21 +0200 Subject: Add ability to search by uuids/actor names --- server/models/video/sql/videos-id-list-query-builder.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/models/video/sql/videos-id-list-query-builder.ts') diff --git a/server/models/video/sql/videos-id-list-query-builder.ts b/server/models/video/sql/videos-id-list-query-builder.ts index d4260c69c..7625c003d 100644 --- a/server/models/video/sql/videos-id-list-query-builder.ts +++ b/server/models/video/sql/videos-id-list-query-builder.ts @@ -35,6 +35,8 @@ export type BuildVideosListQueryOptions = { tagsOneOf?: string[] tagsAllOf?: string[] + uuids?: string[] + withFiles?: boolean accountId?: number @@ -161,6 +163,10 @@ export class VideosIdListQueryBuilder extends AbstractVideosQueryBuilder { this.whereTagsAllOf(options.tagsAllOf) } + if (options.uuids) { + this.whereUUIDs(options.uuids) + } + if (options.nsfw === true) { this.whereNSFW() } else if (options.nsfw === false) { @@ -386,6 +392,10 @@ export class VideosIdListQueryBuilder extends AbstractVideosQueryBuilder { ) } + private whereUUIDs (uuids: string[]) { + this.and.push('"video"."uuid" IN (' + createSafeIn(this.sequelize, uuids) + ')') + } + private whereCategoryOneOf (categoryOneOf: number[]) { this.and.push('"video"."category" IN (:categoryOneOf)') this.replacements.categoryOneOf = categoryOneOf -- cgit v1.2.3