api preparations

integration-tests
Josha von Gizycki 6 years ago
parent d8b9cfa533
commit 0b8414b1ee

@ -14,6 +14,7 @@
ring/ring-codec ring/ring-codec
commons-io commons-io
commons-codec]] commons-codec]]
[ring/ring-json "0.4.0"]
[hiccup "1.0.5"] [hiccup "1.0.5"]
[joshavg/formulare "0.4.0-SNAPSHOT"] [joshavg/formulare "0.4.0-SNAPSHOT"]

@ -1,4 +1,4 @@
module Main exposing (Msg(..), main, update, view) module Explore exposing (Msg(..), main, update, view)
import Browser import Browser
import Html exposing (Html, button, div, text) import Html exposing (Html, button, div, text)

@ -6,6 +6,7 @@
:refer [wrap-defaults site-defaults]] :refer [wrap-defaults site-defaults]]
[ring.util.response :as rur] [ring.util.response :as rur]
[ring.middleware.session.cookie :as session-cookie] [ring.middleware.session.cookie :as session-cookie]
[ring.middleware.json :as ring-json]
[wanijo.home.routes :as home-routes] [wanijo.home.routes :as home-routes]
[wanijo.schema [wanijo.schema
[routes :as schema-routes] [routes :as schema-routes]
@ -46,6 +47,7 @@
(-> app-routes (-> app-routes
devmode/wrap-devmode devmode/wrap-devmode
schema-middleware/wrap-user-schemas schema-middleware/wrap-user-schemas
ring-json/wrap-json-response
(wrap-defaults (wrap-defaults
(assoc-in site-defaults (assoc-in site-defaults
[:session :store] [:session :store]

@ -5,6 +5,7 @@
[wanijo.framework.routing :refer [register! path]] [wanijo.framework.routing :refer [register! path]]
[wanijo.framework.view :as view] [wanijo.framework.view :as view]
[wanijo.instance.domain :as domain-instance] [wanijo.instance.domain :as domain-instance]
[wanijo.schema.domain :as domain-schema]
[wanijo.visualisation [wanijo.visualisation
[domain :as vis-domain] [domain :as vis-domain]
[viz :as viz] [viz :as viz]
@ -17,10 +18,17 @@
[[:h1 "All Instances"] [[:h1 "All Instances"]
(viz/all-instances (vis-domain/all-instance-connections!))])) (viz/all-instances (vis-domain/all-instance-connections!))]))
(defn all-schemas [req]
{:content-type "text/json"
:body (domain-schema/accessible-schemas! (-> req :session :uuid))})
(defroutes routes (defroutes routes
(GET (register! :vis-index "/visualisation/index") (GET (register! :vis-index "/visualisation/index")
[:as req] [:as req]
(vis-view/index req)) (vis-view/index req))
(GET (register! :vis-all-instances "/visualisation/all-instances") (GET (register! :vis-all-instances "/visualisation/all-instances")
[:as req] [:as req]
(all-instances req))) (all-instances req))
(GET (register! :vis-all-schemas "/api/visualisation/schemas")
[:as req]
(all-schemas req)))

Loading…
Cancel
Save