0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-04 01:09:14 -05:00

fix(server): getTimeBuckets not handling boolean filters correctly (#15567)

fix boolean handling
This commit is contained in:
Mert 2025-01-23 16:08:20 -05:00 committed by GitHub
parent 50a2f6193f
commit 071b271484
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -605,10 +605,10 @@ export class AssetRepository implements IAssetRepository {
.where((eb) => eb.or([eb('assets.stackId', 'is', null), eb(eb.table('asset_stack'), 'is not', null)])),
)
.$if(!!options.userIds, (qb) => qb.where('assets.ownerId', '=', anyUuid(options.userIds!)))
.$if(!!options.isArchived, (qb) => qb.where('assets.isArchived', '=', options.isArchived!))
.$if(!!options.isFavorite, (qb) => qb.where('assets.isFavorite', '=', options.isFavorite!))
.$if(options.isArchived !== undefined, (qb) => qb.where('assets.isArchived', '=', options.isArchived!))
.$if(options.isFavorite !== undefined, (qb) => qb.where('assets.isFavorite', '=', options.isFavorite!))
.$if(!!options.assetType, (qb) => qb.where('assets.type', '=', options.assetType!))
.$if(!!options.isDuplicate, (qb) =>
.$if(options.isDuplicate !== undefined, (qb) =>
qb.where('assets.duplicateId', options.isDuplicate ? 'is not' : 'is', null),
)
.$if(!!options.tagId, (qb) => withTagId(qb, options.tagId!)),
@ -622,7 +622,7 @@ export class AssetRepository implements IAssetRepository {
*/
.select((eb) => eb.fn.countAll().as('count'))
.groupBy('timeBucket')
.orderBy('timeBucket', 'desc')
.orderBy('timeBucket', options.order ?? 'desc')
.execute() as any as Promise<TimeBucketItem[]>
);
}
@ -666,7 +666,7 @@ export class AssetRepository implements IAssetRepository {
.where('assets.deletedAt', options.isTrashed ? 'is not' : 'is', null)
.where('assets.isVisible', '=', true)
.where(truncatedDate(options.size), '=', timeBucket.replace(/^[+-]/, ''))
.orderBy('assets.localDateTime', 'desc')
.orderBy('assets.localDateTime', options.order ?? 'desc')
.execute() as any as Promise<AssetEntity[]>;
}