|
|
@ -13,14 +13,39 @@
|
|
|
|
"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-of-coc
|
|
|
|
(neo4j/defquery roles-with-levels-of-coc
|
|
|
|
"MATCH (coc:instance {uuid:{coc_uuid}}),
|
|
|
|
"MATCH (coc:instance {uuid:{coc_uuid}}),
|
|
|
|
(coc)--(:link)--(role:instance),
|
|
|
|
(rschema:schema {uuid:{roleschema_uuid}}),
|
|
|
|
(role)-[:of]->(rschema:schema {uuid:{roleschema_uuid}})
|
|
|
|
(role:instance)-[:of]->(rschema),
|
|
|
|
RETURN role
|
|
|
|
(coc)--(:link)--(role:instance)
|
|
|
|
ORDER BY role.name")
|
|
|
|
OPTIONAL MATCH
|
|
|
|
(defn roles-of-coc! [coc-key]
|
|
|
|
(lschema:schema {uuid:{levelschema_uuid}}),
|
|
|
|
(map :role
|
|
|
|
(level:instance)-[:of]->(lschema),
|
|
|
|
(neo4j/exec-query! roles-of-coc
|
|
|
|
(role)--(:link)-->(level)
|
|
|
|
|
|
|
|
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)))
|
|
|
|