mirror of
https://github.com/immich-app/immich.git
synced 2025-06-02 21:24:28 -04:00
fix(server): do not filter out assets without preview path for person thumbnail generation (#18300)
* allow assets without preview path * update sql * Update person.repository.ts Co-authored-by: Jason Rasmussen <jason@rasm.me> * update sql, e2e --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
parent
3a0ddfb92d
commit
6a4d21205f
@ -202,7 +202,6 @@ describe('/asset', () => {
|
|||||||
{
|
{
|
||||||
name: 'Marie Curie',
|
name: 'Marie Curie',
|
||||||
birthDate: null,
|
birthDate: null,
|
||||||
thumbnailPath: '',
|
|
||||||
isHidden: false,
|
isHidden: false,
|
||||||
faces: [
|
faces: [
|
||||||
{
|
{
|
||||||
@ -219,7 +218,6 @@ describe('/asset', () => {
|
|||||||
{
|
{
|
||||||
name: 'Pierre Curie',
|
name: 'Pierre Curie',
|
||||||
birthDate: null,
|
birthDate: null,
|
||||||
thumbnailPath: '',
|
|
||||||
isHidden: false,
|
isHidden: false,
|
||||||
faces: [
|
faces: [
|
||||||
{
|
{
|
||||||
|
@ -133,18 +133,24 @@ select
|
|||||||
"asset_faces"."imageHeight" as "oldHeight",
|
"asset_faces"."imageHeight" as "oldHeight",
|
||||||
"assets"."type",
|
"assets"."type",
|
||||||
"assets"."originalPath",
|
"assets"."originalPath",
|
||||||
"asset_files"."path" as "previewPath",
|
"exif"."orientation" as "exifOrientation",
|
||||||
"exif"."orientation" as "exifOrientation"
|
(
|
||||||
|
select
|
||||||
|
"asset_files"."path"
|
||||||
|
from
|
||||||
|
"asset_files"
|
||||||
|
where
|
||||||
|
"asset_files"."assetId" = "assets"."id"
|
||||||
|
and "asset_files"."type" = 'preview'
|
||||||
|
) as "previewPath"
|
||||||
from
|
from
|
||||||
"person"
|
"person"
|
||||||
inner join "asset_faces" on "asset_faces"."id" = "person"."faceAssetId"
|
inner join "asset_faces" on "asset_faces"."id" = "person"."faceAssetId"
|
||||||
inner join "assets" on "asset_faces"."assetId" = "assets"."id"
|
inner join "assets" on "asset_faces"."assetId" = "assets"."id"
|
||||||
left join "exif" on "exif"."assetId" = "assets"."id"
|
left join "exif" on "exif"."assetId" = "assets"."id"
|
||||||
left join "asset_files" on "asset_files"."assetId" = "assets"."id"
|
|
||||||
where
|
where
|
||||||
"person"."id" = $1
|
"person"."id" = $1
|
||||||
and "asset_faces"."deletedAt" is null
|
and "asset_faces"."deletedAt" is null
|
||||||
and "asset_files"."type" = $2
|
|
||||||
|
|
||||||
-- PersonRepository.reassignFace
|
-- PersonRepository.reassignFace
|
||||||
update "asset_faces"
|
update "asset_faces"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { ExpressionBuilder, Insertable, Kysely, NotNull, Selectable, sql, Updateable } from 'kysely';
|
import { ExpressionBuilder, Insertable, Kysely, Selectable, sql, Updateable } from 'kysely';
|
||||||
import { jsonObjectFrom } from 'kysely/helpers/postgres';
|
import { jsonObjectFrom } from 'kysely/helpers/postgres';
|
||||||
import { InjectKysely } from 'nestjs-kysely';
|
import { InjectKysely } from 'nestjs-kysely';
|
||||||
import { AssetFaces, DB, FaceSearch, Person } from 'src/db';
|
import { AssetFaces, DB, FaceSearch, Person } from 'src/db';
|
||||||
@ -261,7 +261,6 @@ export class PersonRepository {
|
|||||||
.innerJoin('asset_faces', 'asset_faces.id', 'person.faceAssetId')
|
.innerJoin('asset_faces', 'asset_faces.id', 'person.faceAssetId')
|
||||||
.innerJoin('assets', 'asset_faces.assetId', 'assets.id')
|
.innerJoin('assets', 'asset_faces.assetId', 'assets.id')
|
||||||
.leftJoin('exif', 'exif.assetId', 'assets.id')
|
.leftJoin('exif', 'exif.assetId', 'assets.id')
|
||||||
.leftJoin('asset_files', 'asset_files.assetId', 'assets.id')
|
|
||||||
.select([
|
.select([
|
||||||
'person.ownerId',
|
'person.ownerId',
|
||||||
'asset_faces.boundingBoxX1 as x1',
|
'asset_faces.boundingBoxX1 as x1',
|
||||||
@ -272,13 +271,18 @@ export class PersonRepository {
|
|||||||
'asset_faces.imageHeight as oldHeight',
|
'asset_faces.imageHeight as oldHeight',
|
||||||
'assets.type',
|
'assets.type',
|
||||||
'assets.originalPath',
|
'assets.originalPath',
|
||||||
'asset_files.path as previewPath',
|
|
||||||
'exif.orientation as exifOrientation',
|
'exif.orientation as exifOrientation',
|
||||||
])
|
])
|
||||||
|
.select((eb) =>
|
||||||
|
eb
|
||||||
|
.selectFrom('asset_files')
|
||||||
|
.select('asset_files.path')
|
||||||
|
.whereRef('asset_files.assetId', '=', 'assets.id')
|
||||||
|
.where('asset_files.type', '=', sql.lit(AssetFileType.PREVIEW))
|
||||||
|
.as('previewPath'),
|
||||||
|
)
|
||||||
.where('person.id', '=', id)
|
.where('person.id', '=', id)
|
||||||
.where('asset_faces.deletedAt', 'is', null)
|
.where('asset_faces.deletedAt', 'is', null)
|
||||||
.where('asset_files.type', '=', AssetFileType.PREVIEW)
|
|
||||||
.$narrowType<{ exifImageWidth: NotNull; exifImageHeight: NotNull }>()
|
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user