(pco/defresolver order-line-items []
{::pco/output
[{:order/line-items
[:line-item/id
:line-item/quantity
:line-item/title
:line-item/price-total]}]}
{:order/line-items
[{:line-item/id "1628545763873-1"
:line-item/price-total 28.8M}
{:line-item/id "1628545763873-2"
:line-item/price-total 38.9M}]})
(def items-env
(-> (pci/register
[order-line-items])
(assoc ::pci/index-source-id `line-items)))
(def items-request
(p.eql/boundary-interface items-env))
(pco/defresolver order-items-total [{:keys [order/line-items]}]
{::pco/input
[{:order/line-items
[:line-item/price-total]}]}
{:order/items-total (transduce (map :line-item/price-total) + line-items)})
(def demo-env
(-> (pci/register
[(pcf/foreign-register items-request)
order-items-total])
((requiring-resolve 'com.wsscode.pathom.viz.ws-connector.pathom3/connect-env)
"debug")))
(comment
(p.eql/process demo-env
[:order/items-total]))
The foreign-ast to the order-line-items currently is:
{:children
[{:dispatch-key :order/line-items,
:key :order/line-items,
:type :prop}],
:type :root}
This is missing the sub-query part, it must include :line-item/price-total in the foreign-ast subquery.
The
foreign-astto theorder-line-itemscurrently is:{:children [{:dispatch-key :order/line-items, :key :order/line-items, :type :prop}], :type :root}This is missing the sub-query part, it must include
:line-item/price-totalin the foreign-ast subquery.