diff --git a/src/wanijo/instance/domain.clj b/src/wanijo/instance/domain.clj index f1ac656..95b9e09 100644 --- a/src/wanijo/instance/domain.clj +++ b/src/wanijo/instance/domain.clj @@ -1,6 +1,5 @@ (ns wanijo.instance.domain (:require [clojure.spec.alpha :as spec] - [clojure.spec.test.alpha :as spectest] [wanijo.framework.neo4j :as neo4j] [clojure.pprint :as pprint])) @@ -109,7 +108,19 @@ ON MATCH SET p.updated_at = {now}, p.value = {value}") +(spec/def ::now ::neo4j/date-str) +(spec/def ::prop-tuple-values + (spec/keys :req-un [::neo4j/uuid + ::now + ::value + ::instance_uuid + ::attribute_uuid])) +(spec/def ::prop-tuple + (spec/coll-of + (spec/tuple fn? ::prop-tuple-values))) + (defn instance->prop-tuples [instance] + {:post [(spec/assert ::prop-tuple %)]} (map (fn [prop] (let [prop-uuid (:uuid prop) uuid (if (empty? prop-uuid) @@ -123,18 +134,6 @@ :attribute_uuid (-> prop :attribute :uuid)}])) (:properties instance))) -(spec/def ::prop-tuple-values - (spec/keys :req-un [::neo4j/uuid - ::neo4j/date-str - ::value - ::instance_uuid - ::attribute_uuid])) -(spec/def ::prop-tuple - (spec/tuple fn? ::prop-tuple-values)) -(spec/fdef instance->prop-tuples - :ret (spec/coll-of ::prop-tuple)) -(spectest/instrument `instance->prop-tuples) - (defn edit! [instance] (let [prop-tuples (instance->prop-tuples instance)] (apply neo4j/exec-queries! diff --git a/src/wanijo/main.clj b/src/wanijo/main.clj index 3a3a212..254a548 100644 --- a/src/wanijo/main.clj +++ b/src/wanijo/main.clj @@ -3,6 +3,8 @@ [wanijo.handler :as wanijo]) (:gen-class)) +(spec/check-asserts true) + (defonce server (atom nil)) (defn start-server!