Created
September 30, 2021 09:54
-
-
Save loliveira/37e744c90730339c6a30e47fbab7b56c to your computer and use it in GitHub Desktop.
Plugin alterado para incluir a entity na resolução dos parâmetros da mutation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(p.plugin/defplugin mutation-resolve-params | |
"Remove the run stats from the result meta. Use this in production to avoid sending | |
the stats. This is important for performance and security. | |
TODO: error story is not complete, still up to decide what to do when params can't | |
get fulfilled." | |
{::pcr/wrap-mutate | |
(fn mutation-resolve-params-external [mutate] | |
(fn mutation-resolve-params-internal [env {:keys [key] :as ast}] | |
(let [{::pco/keys [params]} (pci/mutation-config env key) | |
entity (p.ent/entity env) | |
entity-params (merge (:params ast) entity)] | |
(clet [params' (if params | |
(if (::pcra/async-runner? env) | |
(p.a.eql/process env entity-params params) | |
(p.eql/process env entity-params params)) | |
(:params ast))] | |
(mutate env (assoc ast :params params'))))))}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment