Fix saloon replies
The query will return { replyCost: null } if no sub was found because of the left join.
This commit is contained in:
parent
2038701ecf
commit
4e62053b45
@ -27,8 +27,8 @@ export async function getBaseCost ({ models, bio, parentId, subName }) {
|
|||||||
LEFT JOIN "Sub" s ON s.name = COALESCE(r."subName", i."subName")
|
LEFT JOIN "Sub" s ON s.name = COALESCE(r."subName", i."subName")
|
||||||
WHERE i.id = ${Number(parentId)}`
|
WHERE i.id = ${Number(parentId)}`
|
||||||
|
|
||||||
if (!sub) return DEFAULT_ITEM_COST
|
if (sub?.replyCost) return satsToMsats(sub.replyCost)
|
||||||
return satsToMsats(sub.replyCost)
|
return DEFAULT_ITEM_COST
|
||||||
}
|
}
|
||||||
|
|
||||||
const sub = await models.sub.findUnique({ where: { name: subName } })
|
const sub = await models.sub.findUnique({ where: { name: subName } })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user