You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a static beforeUpdate hook and noticed that when my patch call uses a subquery the value(s) are not included in the inputItems array.
Here is the relevant part of my beforeUpdate definition:
Is there any workaround here other than refactoring to not pass a subquery when calling patch? I can do that in this one instance, but it's not maintainable to assume we won't write code like this in the future. I also tried writing an afterUpdate function instead and ran into the same issue.
The text was updated successfully, but these errors were encountered:
That makes sense since PickedItem.query(trx) .findOne({ inventory_uuid: ref('inventory.uuid'), order_uuid: pickedItem.order_uuid, }) .select('quantity')
returns a promise, and objection will not resolve it before calling beforeUpdate.
I'm trying to write a static
beforeUpdate
hook and noticed that when mypatch
call uses a subquery the value(s) are not included in theinputItems
array.Here is the relevant part of my
beforeUpdate
definition:If I call the function like this then I see
quantity_in_stock
provided ininputItems
:However if I call the function using a subquery in the patch parameter I don't see
quantity_in_stock
ininputItems
:Is there any workaround here other than refactoring to not pass a subquery when calling
patch
? I can do that in this one instance, but it's not maintainable to assume we won't write code like this in the future. I also tried writing anafterUpdate
function instead and ran into the same issue.The text was updated successfully, but these errors were encountered: