Last active
November 1, 2022 16:17
-
-
Save mdemare/388d0d32cfe7e426c83c0e861b74c48f to your computer and use it in GitHub Desktop.
Function creating function
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
(defn wrap-load-entities | |
[f ooapi-loader] | |
(let [loader (validating-loader ooapi-loader)] | |
(fn [{:keys [::ooapi/type] :as request}] | |
(if (= "relation" type) | |
(f request) | |
(when-result [entity (loader request) | |
offerings (load-offerings loader request) | |
education-specification (if (= type "education-specification") | |
entity | |
(loader (assoc request | |
::ooapi/type "education-specification" | |
::ooapi/id (ooapi/education-specification-id entity))))] | |
(f (assoc request | |
::ooapi/entity (assoc entity :offerings offerings) | |
::ooapi/education-specification education-specification))))))) | |
(let [ooapi-loader (make-ooapi-http-loader gateway-root-url gateway-credentials) | |
handle-updated (-> updated-handler/update-mutation | |
(updated-handler/wrap-resolver resolver) | |
(wrap-load-entities ooapi-loader))] | |
..) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment