fix: people ordering incorrect (#19298)

This commit is contained in:
Zack Pollard
2025-06-19 17:05:03 +01:00
committed by GitHub
parent 747a72120e
commit fe91b44ab9
3 changed files with 98 additions and 19 deletions

View File

@@ -138,6 +138,7 @@ export class PersonRepository {
.stream();
}
@GenerateSql({ params: [{ take: 1, skip: 0 }, DummyValue.UUID] })
async getAllForUser(pagination: PaginationOptions, userId: string, options?: PersonSearchOptions) {
const items = await this.db
.selectFrom('person')
@@ -179,8 +180,8 @@ export class PersonRepository {
)
.$if(!options?.closestFaceAssetId, (qb) =>
qb
.orderBy(sql`NULLIF(person.name, '')`, (om) => om.asc().nullsLast())
.orderBy((eb) => eb.fn.count('asset_faces.assetId'), 'desc')
.orderBy(sql`NULLIF(person.name, '') asc nulls last`)
.orderBy('person.createdAt'),
)
.$if(!options?.withHidden, (qb) => qb.where('person.isHidden', '=', false))