Open seifip opened 4 years ago
Is anyone actively working on this?
We are definitely looking for this! I could take some times next week to work on it if needed !
+1 it would be very useful !
+1 I have this use case as well and have felt the need of it at multiple occasions
+1 also have a use case for this, would be handy to avoid an extra query
+1 either computed fields or views would be super helpful to incorporate
👍 Would love this feature.
+2 Would be a great feature for my specific use case, it's been over 2 years since the issue has been opened. Can someone from the Hasura team look into this? Thanks!
+1 on this. It is extremely useful for payload body transformations. For example, I need to convert a timestamp string into an epoch integer for a REST endpoint. I created the computed column and am now seeing it cannot be used in an event payload :(
Thank you everyone for the request and comments for this feature. We would like to inform you that this is on our roadmap but we do not have a timeline at present. Please continue to follow this Github issue. We plan to publish on this issue a detailed RFC that covers all use cases and limitations of the feature. We welcome more detailed feedback from you once we provide those details.
Problem
Hasura computed fields are not sent to Hasura Events webhooks.
Example
I have a
total_price
computed field in theorders
table, which issum(price)
of allitems
in that order.I'm now writing a Hasura Event on
order
INSERT
that creates aninvoice
withamount
set tototal_price
of the insertedorder
.The issue:
req.body.event.data.new.total_price
is not available to the webhook.Workaround
My work around is to query
total_price
from Hasura using GraphQL before creating the invoice, but that requires a whole extra query and a dozen lines of code just to get that one missing field.Solution
Computed fields should be part of the Hasura Events trigger payload under
req.body.event.data.old
andreq.body.event.data.new
.