Josha von Gizycki 5 years ago
commit 6f18bfe7f8

@ -12,13 +12,15 @@
findy-by-schema
{:uuid schema-uuid})))
(neo4j/defquery with-name
"MATCH (a:attribute)
(neo4j/defquery with-name-in-schema
"MATCH (a:attribute)-[:of]->(s:schema)
WHERE a.name = {name}
AND s.uuid = {schema_uuid}
RETURN a")
(defn with-name! [matching-name]
(-> (neo4j/exec-query! with-name
{:name matching-name})
(defn with-name-in-schema! [matching-name schema-uuid]
(-> (neo4j/exec-query! with-name-in-schema
{:name matching-name
:schema_uuid schema-uuid})
first
:a))

@ -8,7 +8,8 @@
(defn unique-attr-name-in-schema! [req]
(let [attr-uuid (get-in req [:params :uuid])
name (get-in req [:params :name])
matching-attr (db-attr/with-name! name)]
schema-uuid (get-in req [:params :schema])
matching-attr (db-attr/with-name-in-schema! name schema-uuid)]
(or (nil? matching-attr)
(= attr-uuid (:uuid matching-attr)))))

Loading…
Cancel
Save