From 607fd391309849660d64e955e2de2894c072ef94 Mon Sep 17 00:00:00 2001 From: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Date: Sun, 21 Jan 2024 22:48:29 +0100 Subject: [PATCH] fix(server): only calculate quota usage for internal assets (#6556) only calculate usage for internal assets --- server/src/infra/repositories/user.repository.ts | 2 +- server/src/infra/sql/user.repository.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/infra/repositories/user.repository.ts b/server/src/infra/repositories/user.repository.ts index 4990893014..5d55eea1f6 100644 --- a/server/src/infra/repositories/user.repository.ts +++ b/server/src/infra/repositories/user.repository.ts @@ -121,7 +121,7 @@ export class UserRepository implements IUserRepository { .createQueryBuilder('assets') .select('COALESCE(SUM(exif."fileSizeInByte"), 0)') .leftJoin('assets.exifInfo', 'exif') - .where('assets.ownerId = users.id') + .where('assets.ownerId = users.id AND NOT assets.isExternal') .withDeleted(); const query = this.userRepository diff --git a/server/src/infra/sql/user.repository.sql b/server/src/infra/sql/user.repository.sql index f773f27835..40cf14077a 100644 --- a/server/src/infra/sql/user.repository.sql +++ b/server/src/infra/sql/user.repository.sql @@ -162,6 +162,7 @@ SET LEFT JOIN "exif" "exif" ON "exif"."assetId" = "assets"."id" WHERE "assets"."ownerId" = users.id + AND NOT "assets"."isExternal" ), "updatedAt" = CURRENT_TIMESTAMP WHERE