1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 06:31:58 +00:00

fixes for sync queries

This commit is contained in:
mertalev 2024-12-20 17:18:06 -05:00
parent 5668d332f6
commit e3d08f0856
No known key found for this signature in database
GPG key ID: 3A2B5BFC678DBC80

View file

@ -685,6 +685,9 @@ export class AssetRepository implements IAssetRepository {
const { ownerId, lastId, updatedUntil, limit } = options;
return this.db
.selectFrom('assets')
.selectAll('assets')
.$call(withExif)
.$call((qb) => withStack(qb, { assets: false }))
.where('ownerId', '=', asUuid(ownerId))
.where('isVisible', '=', true)
.where('updatedAt', '<=', updatedUntil)
@ -699,13 +702,8 @@ export class AssetRepository implements IAssetRepository {
return this.db
.selectFrom('assets')
.selectAll('assets')
.select((eb) =>
eb
.selectFrom('asset_stack')
.select((eb) => eb.fn.countAll().as('stackedAssetsCount'))
.whereRef('asset_stack.id', '=', 'assets.stackId')
.as('stackedAssetsCount'),
)
.$call(withExif)
.$call((qb) => withStack(qb, { assets: false }))
.where('ownerId', '=', anyUuid(options.userIds))
.where('isVisible', '=', true)
.where('updatedAt', '>', options.updatedAfter)