From 6b840258c06e230c08c99f1d838cc28f37f77145 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 26 Oct 2023 03:01:12 +0200 Subject: [PATCH] Fix NULL returned for size24h, sizeNow --- api/resolvers/image.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/resolvers/image.js b/api/resolvers/image.js index a3c4e403..68278174 100644 --- a/api/resolvers/image.js +++ b/api/resolvers/image.js @@ -6,6 +6,9 @@ export default { imageFees: async (parent, { s3Keys }, { models, me }) => { const imgFees = await imageFees(s3Keys, { models, me }) delete imgFees.queries + // database returns NULL for sizes if no rows are found + imgFees.size24h ??= 0 + imgFees.sizeNow ??= 0 // add defaults so we can be sure these properties always exist in the frontend return Object.assign({ fees: 0, unpaid: 0, feesPerImage: 0, size24h: 0, sizeNow: 0 }, imgFees) }