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