1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 22:51:59 +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; const { ownerId, lastId, updatedUntil, limit } = options;
return this.db return this.db
.selectFrom('assets') .selectFrom('assets')
.selectAll('assets')
.$call(withExif)
.$call((qb) => withStack(qb, { assets: false }))
.where('ownerId', '=', asUuid(ownerId)) .where('ownerId', '=', asUuid(ownerId))
.where('isVisible', '=', true) .where('isVisible', '=', true)
.where('updatedAt', '<=', updatedUntil) .where('updatedAt', '<=', updatedUntil)
@ -699,13 +702,8 @@ export class AssetRepository implements IAssetRepository {
return this.db return this.db
.selectFrom('assets') .selectFrom('assets')
.selectAll('assets') .selectAll('assets')
.select((eb) => .$call(withExif)
eb .$call((qb) => withStack(qb, { assets: false }))
.selectFrom('asset_stack')
.select((eb) => eb.fn.countAll().as('stackedAssetsCount'))
.whereRef('asset_stack.id', '=', 'assets.stackId')
.as('stackedAssetsCount'),
)
.where('ownerId', '=', anyUuid(options.userIds)) .where('ownerId', '=', anyUuid(options.userIds))
.where('isVisible', '=', true) .where('isVisible', '=', true)
.where('updatedAt', '>', options.updatedAfter) .where('updatedAt', '>', options.updatedAfter)