|
|
|
@ -20,8 +20,10 @@
|
|
|
|
|
{:uuid schema-uuid})))
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery create-instance
|
|
|
|
|
"MATCH (s:schema {uuid:{schema_uuid}})
|
|
|
|
|
CREATE (i:instance {uuid:{uuid}})-[:of]->(s)
|
|
|
|
|
"MATCH (s:schema {uuid:{schema_uuid}}),
|
|
|
|
|
(u:user {uuid:{user_uuid}})
|
|
|
|
|
CREATE (i:instance {uuid:{uuid}})-[:of]->(s),
|
|
|
|
|
(i)-[:created_by]->(u)
|
|
|
|
|
SET i.name = {name},
|
|
|
|
|
i.created_at = {created_at},
|
|
|
|
|
i.updated_at = {created_at}")
|
|
|
|
@ -35,14 +37,15 @@
|
|
|
|
|
p.created_at = {created_at},
|
|
|
|
|
p.updated_at = {updated_at}")
|
|
|
|
|
|
|
|
|
|
(defn create! [schema-uuid instance]
|
|
|
|
|
(defn create! [user-uuid schema-uuid instance]
|
|
|
|
|
(let [instance-uuid (neo4j/uuid)
|
|
|
|
|
now (neo4j/now-str)
|
|
|
|
|
instance-tuple [create-instance
|
|
|
|
|
{:schema_uuid schema-uuid
|
|
|
|
|
:name (:name instance)
|
|
|
|
|
:uuid instance-uuid
|
|
|
|
|
:created_at now}]
|
|
|
|
|
:created_at now
|
|
|
|
|
:user_uuid user-uuid}]
|
|
|
|
|
prop-tuples (for [{:keys [attribute value]} (:properties instance)]
|
|
|
|
|
[create-property
|
|
|
|
|
{:uuid instance-uuid
|
|
|
|
|