Created
March 3, 2017 00:55
-
-
Save halgari/fe3af97ac6756947c1952bcf34086a6a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| (def data {:cards | |
| [{:id "card-1", :idList "list-id-1", :name "Task 1"}], | |
| :lists | |
| [{:id "list-id-1", :name "List 1"} | |
| {:id "list-id-2", :name "List 2"}]}) | |
| (vec (o/for-query | |
| (o/and | |
| (d/query-in data _ [:lists _] ?list-item) | |
| (d/query data ?list-item :id ?list-id) | |
| (d/query data ?list-item :name ?list-name) | |
| (o/project | |
| ;; tad ugly, need to fix this let | |
| (let [list-id ?list-id] | |
| (vec (o/for-query | |
| (o/and | |
| (d/query-in data ?card [:idList] list-id) | |
| (d/query data ?card :name ?card-name) | |
| (d/query data ?card :id ?card-id)) | |
| {:id ?card-id | |
| :name ?card-name}))) ?cards)) | |
| {:id ?list-id | |
| :name ?list-name | |
| :cards ?cards})) | |
| ;; [{:id "list-id-1", :name "List 1", :cards [{:id "card-1", :name "Task 1"}]} | |
| ;; {:id "list-id-2", :name "List 2", :cards []}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment