diff --git a/server/src/queries/asset.job.repository.sql b/server/src/queries/asset.job.repository.sql index e0940572f5..cebb9fe95e 100644 --- a/server/src/queries/asset.job.repository.sql +++ b/server/src/queries/asset.job.repository.sql @@ -519,7 +519,7 @@ select from "asset" where - "asset"."type" = $1 + "asset"."type" = 'VIDEO' and not exists ( select "asset_file"."id" @@ -527,9 +527,9 @@ where "asset_file" where "asset_file"."assetId" = "asset"."id" - and "asset_file"."type" = $2 + and "asset_file"."type" = 'encoded_video' ) - and "asset"."visibility" != $3 + and "asset"."visibility" != 'hidden' and "asset"."deletedAt" is null -- AssetJobRepository.getForVideoConversion @@ -557,7 +557,7 @@ from "asset" where "asset"."id" = $1 - and "asset"."type" = $2 + and "asset"."type" = 'VIDEO' -- AssetJobRepository.streamForMetadataExtraction select diff --git a/server/src/repositories/asset-job.repository.ts b/server/src/repositories/asset-job.repository.ts index 597eb97bb1..3765cad7ed 100644 --- a/server/src/repositories/asset-job.repository.ts +++ b/server/src/repositories/asset-job.repository.ts @@ -309,7 +309,7 @@ export class AssetJobRepository { return this.db .selectFrom('asset') .select(['asset.id']) - .where('asset.type', '=', AssetType.Video) + .where('asset.type', '=', sql.lit(AssetType.Video)) .$if(!force, (qb) => qb .where((eb) => @@ -319,11 +319,11 @@ export class AssetJobRepository { .selectFrom('asset_file') .select('asset_file.id') .whereRef('asset_file.assetId', '=', 'asset.id') - .where('asset_file.type', '=', AssetFileType.EncodedVideo), + .where('asset_file.type', '=', sql.lit(AssetFileType.EncodedVideo)), ), ), ) - .where('asset.visibility', '!=', AssetVisibility.Hidden), + .where('asset.visibility', '!=', sql.lit(AssetVisibility.Hidden)), ) .where('asset.deletedAt', 'is', null) .stream(); @@ -336,7 +336,7 @@ export class AssetJobRepository { .select(['asset.id', 'asset.ownerId', 'asset.originalPath']) .select(withFiles) .where('asset.id', '=', id) - .where('asset.type', '=', AssetType.Video) + .where('asset.type', '=', sql.lit(AssetType.Video)) .executeTakeFirst(); }