This commit is contained in:
keyan 2024-07-10 19:39:53 -05:00
parent c6554d3ca7
commit ce45574bce
1 changed files with 15 additions and 1 deletions

View File

@ -1155,7 +1155,21 @@ export default {
if (item.root) {
return item.root
}
return await getItem(item, { id: item.rootId }, { me, models })
// we can't use getItem because activeOrMine will prevent root from being fetched
const [root] = await itemQueryWithMeta({
me,
models,
query: `
${SELECT}
FROM "Item"
${whereClause(
'"Item".id = $1',
`("Item"."invoiceActionState" IS NULL OR "Item"."invoiceActionState" = 'PAID' OR "Item"."userId" = ${me.id})`
)}`
}, Number(item.rootId))
return root
},
invoice: async (item, args, { models }) => {
if (item.invoiceId) {