hmm, some fixes

integration-tests
Josha von Gizycki 6 years ago
parent fd4d311fd2
commit bf38eddb4a

@ -10,7 +10,9 @@
string?
#(some #{"date" "file" "string" "text"} %)))
(spec/def ::required boolean?)
(spec/def ::required
(spec/or :bool-val boolean?
:nil nil?))
(neo4j/defquery
findy-by-schema
@ -25,3 +27,21 @@
findy-by-schema
{:uuid schema-uuid})
(map :a)))
(neo4j/defquery create-new
"MATCH (u:user)--(s:schema)
WHERE u.uuid = {user_uuid}
AND s.uuid = {schema_uuid}
CREATE (a:attribute)
CREATE (a)-[:created_by]->(u)
CREATE (a)-[:of]->(s)
SET a.type = {type}
SET a.name = {name}")
(defn create-new! [name type schema-uuid user-uuid]
(neo4j/exec-query!
create-new
{:user_uuid user-uuid
:schem_uuid schema-uuid
:type type
:name name}))

@ -2,9 +2,26 @@
(:require [compojure.core :refer [defroutes GET POST]]
[ring.util.response :as resp]
[wanijo.framework.form :as form]
[wanijo.framework.routing :refer [register]]))
[wanijo.framework.routing :refer [register path]]
[wanijo.attribute.domain :as domain]
[wanijo.schema.view :as view-schema]
[wanijo.schema.domain :as domain-schema]))
(defn new! [req])
(defn new! [req]
(let [schema-uuid (get-in req [:params :schema])]
(if (form/valid? view-schema/new-attr-form req)
(do
(domain/create-new!
(get-in req [:params :name])
(get-in req [:params :type])
schema-uuid
(get-in req [:session :uuid]))
(resp/redirect (path :schema-show
schema-uuid)))
(view-schema/show-schema!
(domain-schema/find-by-uuid! schema-uuid)
(domain/find-by-schema! schema-uuid)
req))))
(register :attribute-new "/attribute/new")

@ -9,6 +9,7 @@
[wanijo.home.routes :as home-routes]
[wanijo.schema.routes :as schema-routes]
[wanijo.user.routes :as user-routes]
[wanijo.attribute.routes :as attr-routes]
[wanijo.framework.auth :as auth]
[wanijo.framework.devmode :as devmode]
[wanijo.framework.routing :refer [path]]))
@ -24,7 +25,8 @@
(wrap-login-redirect
(routes home-routes/routes
schema-routes/routes
user-routes/routes))
user-routes/routes
attr-routes/routes))
(route/not-found "Not Found"))
(def app

@ -11,7 +11,7 @@
(neo4j/defquery
all-created-by
"MATCH (s:schema)-[:created_by]->(u:user)
"MATCH (s:schema)-->(u:user)
WHERE u.uuid = {uuid}
RETURN s
ORDER BY s.name")

Loading…
Cancel
Save