Oliver
AEAsh Elixir
•Created by Oliver on 5/19/2025 in #support
How to ergonomically add/remove to an array of embedded resource in graphql
The docs state flatly that if you do updates on an array'd embedded resource it simply calls destroy on them all, and then recreates them. This makes sens as you typically atomically replace the json blurb on read/write.
I have to model this as embedded as I am sharing the table with a legacy system in a transition period, or I would just model it as actual rows and use manage_relationship.
Right now I am looking for the most ergonomic way to have addFoo and removeFoo mutations in my parent resource.
I have modeled up a custom type for a generic addFoo action that loads the parent resource and adds it to the embed list.
Then I hae a custom removeFoo action that loads the list, removes based on finding the ID and then writing it again.
This sort of feels more clunky than my usage of cast_embed in regular ecto based elixir dev, but I am not sure if there is something obvious I am missing here?
14 replies
AEAsh Elixir
•Created by Oliver on 5/13/2025 in #support
Error message in a grapqhl mutation
I have not a clue what can be wrong here, even after trying to understand what makes this error out in the graphql lib code.
11 replies