fix(server): storage usage calculation for motion photos ()

* ignore non external assets in external libraries during syncUsage

* only update storage usage if asset is from internal libraries

* update storage usage on motion photo video asset creation

* updated metadata service tests

* added a test

* simplified syncUsage condition

* check for library type upload instead of not external

* fixed broken sql

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Kevin Huang 2024-04-16 20:04:59 -07:00 committed by GitHub
parent 6d4d0f86cf
commit 17dc12cf7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 50 additions and 4 deletions
server/src/queries

View file

@ -159,10 +159,12 @@ SET
COALESCE(SUM(exif."fileSizeInByte"), 0)
FROM
"assets" "assets"
LEFT JOIN "libraries" "library" ON "library"."id" = "assets"."libraryId"
AND ("library"."deletedAt" IS NULL)
LEFT JOIN "exif" "exif" ON "exif"."assetId" = "assets"."id"
WHERE
"assets"."ownerId" = users.id
AND NOT "assets"."isExternal"
AND "library"."type" = 'UPLOAD'
),
"updatedAt" = CURRENT_TIMESTAMP
WHERE