|
|
@ -13,39 +13,14 @@
|
|
|
|
"req" "44b02979-7e78-491c-8631-fc49a47b799d"
|
|
|
|
"req" "44b02979-7e78-491c-8631-fc49a47b799d"
|
|
|
|
"prk" "318ee72d-8a8b-42c5-aa90-d5efc1787d22"})
|
|
|
|
"prk" "318ee72d-8a8b-42c5-aa90-d5efc1787d22"})
|
|
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery roles-with-levels-of-coc
|
|
|
|
(neo4j/defquery roles-of-coc
|
|
|
|
"MATCH (coc:instance {uuid:{coc_uuid}}),
|
|
|
|
"MATCH (coc:instance {uuid:{coc_uuid}}),
|
|
|
|
(rschema:schema {uuid:{roleschema_uuid}}),
|
|
|
|
(coc)--(:link)--(role:instance),
|
|
|
|
(role:instance)-[:of]->(rschema),
|
|
|
|
(role)-[:of]->(rschema:schema {uuid:{roleschema_uuid}})
|
|
|
|
(coc)--(:link)--(role:instance)
|
|
|
|
RETURN role
|
|
|
|
OPTIONAL MATCH
|
|
|
|
ORDER BY role.name")
|
|
|
|
(lschema:schema {uuid:{levelschema_uuid}}),
|
|
|
|
(defn roles-of-coc! [coc-key]
|
|
|
|
(level:instance)-[:of]->(lschema),
|
|
|
|
(map :role
|
|
|
|
(role)--(:link)-->(level)
|
|
|
|
(neo4j/exec-query! roles-of-coc
|
|
|
|
RETURN role, level")
|
|
|
|
|
|
|
|
(defn roles-with-levels-of-coc! [coc-key]
|
|
|
|
|
|
|
|
(->> (neo4j/exec-query! roles-with-levels-of-coc
|
|
|
|
|
|
|
|
{:coc_uuid (get coc-instance-uuids coc-key)
|
|
|
|
{:coc_uuid (get coc-instance-uuids coc-key)
|
|
|
|
:roleschema_uuid (:role schema-uuids)
|
|
|
|
:roleschema_uuid (:role schema-uuids)})))
|
|
|
|
:levelschema_uuid (:level schema-uuids)})
|
|
|
|
|
|
|
|
(group-by :role)
|
|
|
|
|
|
|
|
(map (fn [[role rows]]
|
|
|
|
|
|
|
|
{:role role
|
|
|
|
|
|
|
|
:levels (filter some? (map :level rows))}))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
|
|
|
|
(roles-with-levels-of-coc! "dev")
|
|
|
|
|
|
|
|
(neo4j/exec-query! roles-with-levels-of-coc!
|
|
|
|
|
|
|
|
{:coc_uuid (get coc-instance-uuids "dev")
|
|
|
|
|
|
|
|
:roleschema_uuid (:role schema-uuids)
|
|
|
|
|
|
|
|
:levelschema_uuid (:level schema-uuids)}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery coc
|
|
|
|
|
|
|
|
"MATCH (coc:instance {uuid:{uuid}})
|
|
|
|
|
|
|
|
RETURN coc")
|
|
|
|
|
|
|
|
(defn coc! [coc-key]
|
|
|
|
|
|
|
|
(-> (neo4j/exec-query! coc
|
|
|
|
|
|
|
|
{:uuid (get coc-instance-uuids coc-key)})
|
|
|
|
|
|
|
|
first
|
|
|
|
|
|
|
|
:coc
|
|
|
|
|
|
|
|
(assoc :key coc-key)))
|
|
|
|
|
|
|
|