fix(server): server stats showing wrong quota usage ()

* Add filter to exclude external libraries from the user quota usage

* Add filter to exclude external libraries from the user quota usage

* fix sql syntax
This commit is contained in:
Alejandro Armas 2024-06-08 06:56:11 -03:00 committed by GitHub
parent 62f8bd80f4
commit 3c5ba77e86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions
server/src/queries

View file

@ -130,7 +130,13 @@ SELECT
"assets"."type" = 'VIDEO'
AND "assets"."isVisible"
) AS "videos",
COALESCE(SUM("exif"."fileSizeInByte"), 0) AS "usage"
COALESCE(
SUM("exif"."fileSizeInByte") FILTER (
WHERE
"assets"."libraryId" IS NULL
),
0
) AS "usage"
FROM
"users" "users"
LEFT JOIN "assets" "assets" ON "assets"."ownerId" = "users"."id"