more spec stuff

integration-tests
Josha von Gizycki 5 years ago
parent 0b76877028
commit bac79cd60c

@ -65,16 +65,18 @@
SET p.value = {value}, SET p.value = {value},
p.created_at = {created_at}, p.created_at = {created_at},
p.updated_at = {updated_at}") p.updated_at = {updated_at}")
(defn create! [user-uuid schema-uuid instance] (defn create! [user-uuid
schema-uuid
{:keys [name properties]}]
(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
:uuid instance-uuid :uuid instance-uuid
:created_at now :created_at now
:user_uuid user-uuid}] :user_uuid user-uuid}]
prop-tuples (for [{:keys [attribute value]} (:properties instance)] prop-tuples (for [{:keys [attribute value]} properties]
[create-property [create-property
{:uuid instance-uuid {:uuid instance-uuid
:attr_uuid (:uuid attribute) :attr_uuid (:uuid attribute)

@ -1,10 +1,11 @@
(ns wanijo.instance.forms (ns wanijo.instance.forms
(:require [wanijo.instance.domain :as domain])) (:require [wanijo.specs :as specs]
[wanijo.instance.domain :as domain]))
(def form (def form
{:fields {:name {:label "Name" {:fields {:name {:label "Name"
:required true :required true
:spec ::domain/name}}}) :spec ::specs/req-name}}})
(defn link-form [instances] (defn link-form [instances]
{:fields {:name {:label "Name"} {:fields {:name {:label "Name"}

@ -7,6 +7,8 @@
(spec/def ::created-at (spec/def ::created-at
(spec/and string? ::neo4j/date-str)) (spec/and string? ::neo4j/date-str))
(spec/def ::name string?) (spec/def ::name string?)
(spec/def ::req-name
(spec/and ::name (complement empty?)))
(spec/def ::instance_uuid ::neo4j/uuid) (spec/def ::instance_uuid ::neo4j/uuid)
(spec/def ::attribute_uuid ::neo4j/uuid) (spec/def ::attribute_uuid ::neo4j/uuid)
(spec/def ::now ::neo4j/date-str) (spec/def ::now ::neo4j/date-str)

Loading…
Cancel
Save