Skip to content

Commit 65b1db2

Browse files
committed
Fix item cost in details
1 parent 3a93b04 commit 65b1db2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

api/paidAction/itemCreate.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ export async function getBaseCost ({ models, bio, parentId, subName }) {
3030

3131
const root = parent.root ?? parent
3232

33-
if (!root.sub) return DEFAULT_ITEM_COST
34-
return satsToMsats(root.sub.replyCost)
33+
// XXX Prisma does not support case-insensitive joins on CITEXT column
34+
// so we fetch the territory in a separate query
35+
const sub = await models.sub.findUnique({
36+
where: { name: root.subName }
37+
})
38+
39+
if (!sub) return DEFAULT_ITEM_COST
40+
return satsToMsats(sub.replyCost)
3541
}
3642

3743
const sub = await models.sub.findUnique({ where: { name: subName } })

0 commit comments

Comments
 (0)