mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 11:24:37 +02:00
fix(server): sort un-named faces in query (#3662)
This commit is contained in:
parent
f55c80eadf
commit
b1b215f083
@ -27,10 +27,8 @@ export class PersonService {
|
||||
|
||||
async getAll(authUser: AuthUserDto, dto: PersonSearchDto): Promise<PeopleResponseDto> {
|
||||
const people = await this.repository.getAll(authUser.id, { minimumFaceCount: 1 });
|
||||
const named = people.filter((person) => !!person.name);
|
||||
const unnamed = people.filter((person) => !person.name);
|
||||
|
||||
const persons: PersonResponseDto[] = [...named, ...unnamed]
|
||||
const persons: PersonResponseDto[] = people
|
||||
// with thumbnails
|
||||
.filter((person) => !!person.thumbnailPath)
|
||||
.map((person) => mapPerson(person));
|
||||
|
@ -56,6 +56,7 @@ export class PersonRepository implements IPersonRepository {
|
||||
.leftJoin('person.faces', 'face')
|
||||
.where('person.ownerId = :userId', { userId })
|
||||
.orderBy('COUNT(face.assetId)', 'DESC')
|
||||
.addOrderBy("NULLIF(person.name, '')", 'ASC', 'NULLS LAST')
|
||||
.having('COUNT(face.assetId) >= :faces', { faces: options?.minimumFaceCount || 1 })
|
||||
.groupBy('person.id')
|
||||
.limit(500)
|
||||
|
Loading…
Reference in New Issue
Block a user