Created
November 1, 2022 16:19
Normal function called by wrapping 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 load-entities | |
[f loader {: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))))) | |
(defn wrap-load-entities | |
[f ooapi-loader] | |
(let [loader (validating-loader ooapi-loader)] | |
(fn [request] | |
(load-entities f loader request)))) | |
(let [ooapi-loader (make-ooapi-http-loader gateway-root-url gateway-credentials) | |
entity-loader (wrap-load-entities rio-config ooapi-loader)] | |
..) |
joodie
commented
Nov 3, 2022
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment