This repository was archived by the owner on Apr 17, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
functions/src/app/augment Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 22 (:require [backend-shared.service.index :refer [perform fetch]]
33 [shared.protocols.actionable :as ac]
44 [shared.protocols.queryable :as qa]
5- [shared.protocols.loggable :as log])
5+ [shared.protocols.loggable :as log]
6+ [cljs.core.async :as async]
7+ [clojure.string :as str])
68 (:require-macros [cljs.core.async.macros :refer [go]]))
79
810(defn mappings []
911
12+ (defn to-course-query [{:keys [offcourse-id]}]
13+ (let [[repo curator course-id revision checkpoint-id] (str/split offcourse-id " ::" )]
14+ {:course-id (str repo " ::" curator " ::" course-id)
15+ :checkpoint-id checkpoint-id
16+ :revision revision}))
17+
1018 (defmethod fetch :bookmarks [{:keys [db]} payload]
11- (let [query (map (fn [{:keys [bookmark-url]}] {:resource-url bookmark-url}) payload)]
12- (qa/fetch db query)))
19+ (go
20+ (let [bookmarks-query (map (fn [{:keys [bookmark-url]}] {:resource-url bookmark-url}) payload)
21+ {:keys [found]} (async/<! (qa/fetch db bookmarks-query))
22+ courses-query (map to-course-query found)
23+ {:keys [found]} (async/<! (qa/fetch db courses-query))]
24+ found)))
1325
1426 (defmethod perform [:put :nothing ] [_ _]
1527 (go {:error :no-payload }))
You can’t perform that action at this time.
0 commit comments