Fork me on GitHub
#pathom
<
2021-08-08
>
plins22:08:44

Im trying to learn pathom by building a simple CRUD api, and I wonder what is the pattern (if there is one) on what is returned on mutations? should I return on update/create?

wilkerlucio23:08:51

usually you can return the map of the just created entity, so the user can read from it if desired

souenzzo00:08:00

Consider a schema where a "user" has a "cart" When the user call (create-cart {}), I would return

(pc/defmutation create-card ....
   {:user/id ...
    :cart/id ...})
Then, the frontend can call both: [{(create-cart {}) [:user/name {:user/cart [:cart/id :cart/empty?]}]}] [{(create-cart {}) [:cart/id :cart/empty?]}]

souenzzo00:08:39

IMHO, one of the main points of pathom/graph API's is that you don't need to think about "what to return"

thanks3 3