From 65b1db23a72f90398d097a3001ad44692bd7fe42 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 10 Mar 2025 17:48:36 -0500 Subject: [PATCH] Fix item cost in details --- api/paidAction/itemCreate.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/paidAction/itemCreate.js b/api/paidAction/itemCreate.js index be7a77d6..da98a234 100644 --- a/api/paidAction/itemCreate.js +++ b/api/paidAction/itemCreate.js @@ -30,8 +30,14 @@ export async function getBaseCost ({ models, bio, parentId, subName }) { const root = parent.root ?? parent - if (!root.sub) return DEFAULT_ITEM_COST - return satsToMsats(root.sub.replyCost) + // XXX Prisma does not support case-insensitive joins on CITEXT column + // so we fetch the territory in a separate query + const sub = await models.sub.findUnique({ + where: { name: root.subName } + }) + + if (!sub) return DEFAULT_ITEM_COST + return satsToMsats(sub.replyCost) } const sub = await models.sub.findUnique({ where: { name: subName } })