mirror of
https://github.com/immich-app/immich.git
synced 2025-02-11 01:18:24 -05:00
fix(server): getTimeBuckets
not handling boolean filters correctly (#15567)
fix boolean handling
This commit is contained in:
parent
50a2f6193f
commit
071b271484
1 changed files with 5 additions and 5 deletions
|
@ -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)])),
|
.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.userIds, (qb) => qb.where('assets.ownerId', '=', anyUuid(options.userIds!)))
|
||||||
.$if(!!options.isArchived, (qb) => qb.where('assets.isArchived', '=', options.isArchived!))
|
.$if(options.isArchived !== undefined, (qb) => qb.where('assets.isArchived', '=', options.isArchived!))
|
||||||
.$if(!!options.isFavorite, (qb) => qb.where('assets.isFavorite', '=', options.isFavorite!))
|
.$if(options.isFavorite !== undefined, (qb) => qb.where('assets.isFavorite', '=', options.isFavorite!))
|
||||||
.$if(!!options.assetType, (qb) => qb.where('assets.type', '=', options.assetType!))
|
.$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),
|
qb.where('assets.duplicateId', options.isDuplicate ? 'is not' : 'is', null),
|
||||||
)
|
)
|
||||||
.$if(!!options.tagId, (qb) => withTagId(qb, options.tagId!)),
|
.$if(!!options.tagId, (qb) => withTagId(qb, options.tagId!)),
|
||||||
|
@ -622,7 +622,7 @@ export class AssetRepository implements IAssetRepository {
|
||||||
*/
|
*/
|
||||||
.select((eb) => eb.fn.countAll().as('count'))
|
.select((eb) => eb.fn.countAll().as('count'))
|
||||||
.groupBy('timeBucket')
|
.groupBy('timeBucket')
|
||||||
.orderBy('timeBucket', 'desc')
|
.orderBy('timeBucket', options.order ?? 'desc')
|
||||||
.execute() as any as Promise<TimeBucketItem[]>
|
.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.deletedAt', options.isTrashed ? 'is not' : 'is', null)
|
||||||
.where('assets.isVisible', '=', true)
|
.where('assets.isVisible', '=', true)
|
||||||
.where(truncatedDate(options.size), '=', timeBucket.replace(/^[+-]/, ''))
|
.where(truncatedDate(options.size), '=', timeBucket.replace(/^[+-]/, ''))
|
||||||
.orderBy('assets.localDateTime', 'desc')
|
.orderBy('assets.localDateTime', options.order ?? 'desc')
|
||||||
.execute() as any as Promise<AssetEntity[]>;
|
.execute() as any as Promise<AssetEntity[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue