From 4213f6159c5f2b2513300fd791c0fd653081d085 Mon Sep 17 00:00:00 2001
From: simon
Date: Sat, 15 Jul 2017 17:51:28 +0100
Subject: [PATCH 01/51] #28: only the very beginning of the beginning
Don't even know if this is worth doing - this specification language doesn't yet mean much to me.
---
doc/specification/api.v1.raml | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 doc/specification/api.v1.raml
diff --git a/doc/specification/api.v1.raml b/doc/specification/api.v1.raml
new file mode 100644
index 0000000..44bd043
--- /dev/null
+++ b/doc/specification/api.v1.raml
@@ -0,0 +1,23 @@
+#%RAML 0.8
+ ---
+ title: YouYesYet API
+ baseUri: https://api.yyy.scot/{version}
+ version: v1
+
+
+/canvassers:
+ get:
+ put:
+
+/electors:
+ get:
+ /{id}:
+ get:
+ /{address_id}:
+ get:
+
+# Location isn't a real entity in the database, but it is a means of searching for
+# addresses and electors.
+/location:
+ /{lat}/{long}/{radius}:
+ get:
From e300d0c4c5bb7fc919c5a0915d011e34627e3c9b Mon Sep 17 00:00:00 2001
From: simon
Date: Sat, 22 Jul 2017 11:04:59 +0100
Subject: [PATCH 02/51] #28 Changed the way I'm doing REST, for simplicity
---
src/clj/youyesyet/routes/rest.clj | 49 +++++++++++++++++++++++++++
src/clj/youyesyet/routes/services.clj | 5 ++-
2 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 src/clj/youyesyet/routes/rest.clj
diff --git a/src/clj/youyesyet/routes/rest.clj b/src/clj/youyesyet/routes/rest.clj
new file mode 100644
index 0000000..6ca9b3f
--- /dev/null
+++ b/src/clj/youyesyet/routes/rest.clj
@@ -0,0 +1,49 @@
+(ns ^{:doc "Routes which handle data transfer to/from the canvasser app."
+ :author "Simon Brooke"} youyesyet.routes.rest
+ (:require [clojure.walk :refer [keywordize-keys]]
+ [noir.response :as nresponse]
+ [noir.util.route :as route]
+ [youyesyet.db.core :as db-core]
+ [compojure.core :refer [defroutes GET POST]]
+ [ring.util.http-response :as response]
+ [clojure.java.io :as io]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;
+;;;; youyesyet.routes.rest: Routes which handle data transfer to/from the
+;;;; canvasser app.
+;;;;
+;;;; This program is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU General Public License
+;;;; as published by the Free Software Foundation; either version 2
+;;;; of the License, or (at your option) any later version.
+;;;;
+;;;; This program is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with this program; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+;;;; USA.
+;;;;
+;;;; Copyright (C) 2017 Simon Brooke for Radical Independence Campaign
+;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn get-local-data
+ "Get data local to the user of the canvasser app. Expects arguments `lat` and
+ `long`. Returns a block of data for that locality"
+ [request]
+ )
+
+(defn get-issues
+ "Get current issues. No arguments expected."
+ [request]
+
+(defroutes rest-routes
+ (GET "/rest/get-local-data" request (route/restricted (get-local-data request)))
+ (GET "/rest/get-issues" request (route/restricted (get-issues request)))
+ (GET "/rest/set-intention" request (route/restricted (set-intention request)))
+ (GET "/rest/request-followup" request (route/restricted (request-followup request))))
diff --git a/src/clj/youyesyet/routes/services.clj b/src/clj/youyesyet/routes/services.clj
index c0de2b5..5698b0c 100644
--- a/src/clj/youyesyet/routes/services.clj
+++ b/src/clj/youyesyet/routes/services.clj
@@ -1,4 +1,7 @@
-(ns youyesyet.routes.services
+;;;; This is probably the right way to do the API, but I don't understand it.
+
+(ns ^{:doc "REST API."
+ :author "Simon Brooke"} youyesyet.routes.services
(:require [clj-http.client :as client]
[ring.util.http-response :refer :all]
[compojure.api.sweet :refer :all]
From 9157871cc15f6dbbacc9a2840c6882ed8693cd29 Mon Sep 17 00:00:00 2001
From: simon
Date: Mon, 24 Jul 2017 19:46:52 +0100
Subject: [PATCH 03/51] Added a note on locality indexing.
---
doc/specification/scaling.md | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/doc/specification/scaling.md b/doc/specification/scaling.md
index bfc16de..da3687c 100644
--- a/doc/specification/scaling.md
+++ b/doc/specification/scaling.md
@@ -56,8 +56,38 @@ All this normalisation and memoisation reduces the number of read requests on th
Note that [clojure.core.memoize](https://github.com/clojure/core.memoize) provides us with functions to create both size-limited, least-recently-used caches and duration limited, time-to-live caches.
+### Searching the database for localities
+
At 56 degrees north there are 111,341 metres per degree of latitude, 62,392 metres per degree of longitude. So a 100 metre box is about 0.0016 degrees east-west and .0009 degrees north-south. If we simplify that slightly (and we don't need square boxes, we need units of area covering a group of people working together) then we can take .001 of a degree in either direction which is computationally cheap.
+Of course we could have a search query like this
+
+ select * from addresses
+ where latitude > 56.003
+ and latitude < 56.004
+ and longitude > -4.771
+ and longitude < -4.770;
+
+And it would work - but it would be computationally expensive. If we call each of these .001 x .001 roughly-rectangles a **locality**, then we can give every locality an integer index as follows
+
+ (defn locality-index
+ "Compute a locality for this `latitude`, `longitude` pair."
+ [latitude longitude]
+ (+
+ (* 10000 ;; left-shift the latitude component four digits
+ (integer
+ (* latitude 1000)))
+ (- ;; invert the sign of the longitude component, since
+ ;; we're interested in localities West of Greenwich.
+ (integer
+ (* longitude 1000)))))
+
+For values in Scotland, this gives us a number comfortable smaller than the maximum size of a 32 bit integer. Note that this isn't generally the case, so to adapt this software for use in Canada, for example, a more general solution would need to be chosen; but this will do for now. If we compute this index at the time the address is geocoded, then we can achieve the exact same results as the query given above with a much simpler query:
+
+ select * from address where locality = 560034770;
+
+If the locality field is indexed (which obviously it should be) this query becomes very cheap.
+
### Geographic sharding
Volunteers canvassing simultaneously in the same street or the same locality need to see in near real time which dwellings have been canvassed by other volunteers, otherwise we'll get the same households canvassed repeatedly, which wastes volunteer time and annoys voters. So they all need to be sending updates to, and receiving updates from, the same server. But volunteers canvassing in Aberdeen don't need to see in near real time what is happening in Edinburgh.
From 604e7f485d2eb9e8642091c7dba7fce13247c53e Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Sat, 17 Mar 2018 18:33:06 +0000
Subject: [PATCH 04/51] Squirrel-parse generated routes and queries are now
working
Routes and queries auto-generated from migrations by [squirrel-parse]() are now actually working!
---
.../entity-relationship-diagram.svg | 10 +-
.../20161014170335-basic-setup.up.sql | 4 +-
...0316110100-intentions-and-options.down.sql | 24 +
...180316110100-intentions-and-options.up.sql | 30 +
.../migrations/20180317170000-gender.down.sql | 3 +
.../migrations/20180317170000-gender.up.sql | 11 +
.../20180317170907-reference-data.down.sql | 10 +
.../20180317170907-reference-data.up.sql | 10 +
.../20180317175047-test-data.down.sql | 3 +
.../20180317175047-test-data.up.sql | 41 +
resources/sql/queries.auto.sql | 735 ++++++++++++
src/clj/youyesyet/db/core.clj | 14 +-
src/clj/youyesyet/handler.clj | 7 +-
src/clj/youyesyet/routes/auto_json_routes.clj | 1035 +++++++++++++++++
src/clj/youyesyet/routes/rest.clj | 2 +-
15 files changed, 1923 insertions(+), 16 deletions(-)
create mode 100644 resources/migrations/20180316110100-intentions-and-options.down.sql
create mode 100644 resources/migrations/20180316110100-intentions-and-options.up.sql
create mode 100644 resources/migrations/20180317170000-gender.down.sql
create mode 100644 resources/migrations/20180317170000-gender.up.sql
create mode 100644 resources/migrations/20180317170907-reference-data.down.sql
create mode 100644 resources/migrations/20180317170907-reference-data.up.sql
create mode 100644 resources/migrations/20180317175047-test-data.down.sql
create mode 100644 resources/migrations/20180317175047-test-data.up.sql
create mode 100644 resources/sql/queries.auto.sql
create mode 100644 src/clj/youyesyet/routes/auto_json_routes.clj
diff --git a/doc/specification/entity-relationship-diagram.svg b/doc/specification/entity-relationship-diagram.svg
index 0de6cf0..dbb5475 100644
--- a/doc/specification/entity-relationship-diagram.svg
+++ b/doc/specification/entity-relationship-diagram.svg
@@ -25,9 +25,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.979899"
- inkscape:cx="833.70674"
- inkscape:cy="324.89697"
+ inkscape:zoom="0.9899495"
+ inkscape:cx="472.36875"
+ inkscape:cy="325.73865"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -62,8 +62,8 @@
id="rect4428"
width="1030"
height="730"
- x="232.23355"
- y="376.0018" />
+ x="16.060907"
+ y="312.36218" />
sql-date (.getTime) (java.util.Date.)))
diff --git a/src/clj/youyesyet/handler.clj b/src/clj/youyesyet/handler.clj
index f898fe5..bc67a8c 100644
--- a/src/clj/youyesyet/handler.clj
+++ b/src/clj/youyesyet/handler.clj
@@ -3,6 +3,7 @@
[youyesyet.layout :refer [error-page]]
[youyesyet.routes.home :refer [home-routes]]
[youyesyet.routes.oauth :refer [oauth-routes]]
+ [youyesyet.routes.auto-json-routes :refer [auto-rest-routes]]
[compojure.route :as route]
[youyesyet.env :refer [defaults]]
[mount.core :as mount]
@@ -37,6 +38,9 @@
(-> #'home-routes
(wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats))
+ (-> #'auto-rest-routes
+ (wrap-routes middleware/wrap-csrf)
+ (wrap-routes middleware/wrap-formats))
#'oauth-routes
(route/not-found
(:body
@@ -44,4 +48,5 @@
:title "page not found"})))))
-(def app (middleware/wrap-base #'app-routes))
+(def app #'app-routes)
+ ;;(middleware/wrap-base #'app-routes))
diff --git a/src/clj/youyesyet/routes/auto_json_routes.clj b/src/clj/youyesyet/routes/auto_json_routes.clj
new file mode 100644
index 0000000..8d3d707
--- /dev/null
+++ b/src/clj/youyesyet/routes/auto_json_routes.clj
@@ -0,0 +1,1035 @@
+(ns
+ youyesyet.routes.auto-json-routes
+ (require
+ [noir.response :as nresponse]
+ [noir.util.route :as route]
+ [compojure.core :refer [defroutes GET POST]]
+ [ring.util.http-response :as response]
+ [clojure.java.io :as io]
+ [hugsql.core :as hugsql]
+ [youyesyet.db.core :as db]))
+
+
+(declare
+ create-addresse
+ create-authority
+ create-canvasser
+ create-district
+ create-elector
+ create-followupaction
+ create-followupmethod
+ create-followuprequest
+ create-intention
+ create-issue
+ create-issueexpertise
+ create-option
+ create-role
+ create-rolemembership
+ create-schema-migration
+ create-team
+ create-teammembership
+ create-teamorganisership
+ create-visit
+ delete-addresse
+ delete-authority
+ delete-canvasser
+ delete-district
+ delete-elector
+ delete-followupaction
+ delete-followupmethod
+ delete-followuprequest
+ delete-issue
+ delete-option
+ delete-visit
+ get-addresse
+ get-authority
+ get-canvasser
+ get-district
+ get-elector
+ get-followupaction
+ get-followupmethod
+ get-followuprequest
+ get-issue
+ get-option
+ get-visit
+ list-addresses
+ list-addresses-by-district
+ list-authorities
+ list-canvassers
+ list-canvassers-by-addresse
+ list-canvassers-by-authoritie
+ list-canvassers-by-elector
+ list-districts
+ list-electors
+ list-electors-by-addresse
+ list-followupactions
+ list-followupactions-by-canvasser
+ list-followupactions-by-followuprequest
+ list-followupmethods
+ list-followuprequests
+ list-followuprequests-by-elector
+ list-followuprequests-by-followupmethod
+ list-followuprequests-by-issue
+ list-followuprequests-by-visit
+ list-intentions-electors-by-option
+ list-intentions-electors-by-visit
+ list-intentions-options-by-elector
+ list-intentions-options-by-visit
+ list-intentions-visits-by-elector
+ list-intentions-visits-by-option
+ list-issueexpertise-canvassers-by-followupmethod
+ list-issueexpertise-canvassers-by-issue
+ list-issueexpertise-followupmethods-by-canvasser
+ list-issueexpertise-followupmethods-by-issue
+ list-issueexpertise-issues-by-canvasser
+ list-issueexpertise-issues-by-followupmethod
+ list-issues
+ list-options
+ list-rolememberships-canvassers-by-role
+ list-rolememberships-roles-by-canvasser
+ list-roles
+ list-schemamigrations
+ list-teammemberships-canvassers-by-team
+ list-teammemberships-teams-by-canvasser
+ list-teamorganiserships-canvassers-by-team
+ list-teamorganiserships-teams-by-canvasser
+ list-teams
+ list-teams-by-district
+ list-visits
+ list-visits-by-addresse
+ list-visits-by-canvasser
+ update-addresse
+ update-canvasser
+ update-district
+ update-elector
+ update-followupaction
+ update-followuprequest
+ update-issue
+ update-visit)
+
+
+(defroutes
+ auto-rest-routes
+ (POST "/json/auto/create-addresse" request (create-addresse request))
+ (POST
+ "/json/auto/create-authority"
+ request
+ (create-authority request))
+ (POST
+ "/json/auto/create-canvasser"
+ request
+ (create-canvasser request))
+ (POST "/json/auto/create-district" request (create-district request))
+ (POST "/json/auto/create-elector" request (create-elector request))
+ (POST
+ "/json/auto/create-followupaction"
+ request
+ (create-followupaction request))
+ (POST
+ "/json/auto/create-followupmethod"
+ request
+ (create-followupmethod request))
+ (POST
+ "/json/auto/create-followuprequest"
+ request
+ (create-followuprequest request))
+ (POST
+ "/json/auto/create-intention"
+ request
+ (create-intention request))
+ (POST "/json/auto/create-issue" request (create-issue request))
+ (POST
+ "/json/auto/create-issueexpertise"
+ request
+ (create-issueexpertise request))
+ (POST "/json/auto/create-option" request (create-option request))
+ (POST "/json/auto/create-role" request (create-role request))
+ (POST
+ "/json/auto/create-rolemembership"
+ request
+ (create-rolemembership request))
+ (POST
+ "/json/auto/create-schema-migration"
+ request
+ (create-schema-migration request))
+ (POST "/json/auto/create-team" request (create-team request))
+ (POST
+ "/json/auto/create-teammembership"
+ request
+ (create-teammembership request))
+ (POST
+ "/json/auto/create-teamorganisership"
+ request
+ (create-teamorganisership request))
+ (POST "/json/auto/create-visit" request (create-visit request))
+ (POST "/json/auto/delete-addresse" request (delete-addresse request))
+ (POST
+ "/json/auto/delete-authority"
+ request
+ (delete-authority request))
+ (POST
+ "/json/auto/delete-canvasser"
+ request
+ (delete-canvasser request))
+ (POST "/json/auto/delete-district" request (delete-district request))
+ (POST "/json/auto/delete-elector" request (delete-elector request))
+ (POST
+ "/json/auto/delete-followupaction"
+ request
+ (delete-followupaction request))
+ (POST
+ "/json/auto/delete-followupmethod"
+ request
+ (delete-followupmethod request))
+ (POST
+ "/json/auto/delete-followuprequest"
+ request
+ (delete-followuprequest request))
+ (POST "/json/auto/delete-issue" request (delete-issue request))
+ (POST "/json/auto/delete-option" request (delete-option request))
+ (POST "/json/auto/delete-visit" request (delete-visit request))
+ (POST "/json/auto/get-addresse" request (get-addresse request))
+ (POST "/json/auto/get-authority" request (get-authority request))
+ (POST "/json/auto/get-canvasser" request (get-canvasser request))
+ (POST "/json/auto/get-district" request (get-district request))
+ (POST "/json/auto/get-elector" request (get-elector request))
+ (POST
+ "/json/auto/get-followupaction"
+ request
+ (get-followupaction request))
+ (POST
+ "/json/auto/get-followupmethod"
+ request
+ (get-followupmethod request))
+ (POST
+ "/json/auto/get-followuprequest"
+ request
+ (get-followuprequest request))
+ (POST "/json/auto/get-issue" request (get-issue request))
+ (POST "/json/auto/get-option" request (get-option request))
+ (POST "/json/auto/get-visit" request (get-visit request))
+ (GET "/json/auto/list-addresses" request (list-addresses request))
+ (GET
+ "/json/auto/list-addresses-by-district"
+ request
+ (list-addresses-by-district request))
+ (GET "/json/auto/list-authorities" request (list-authorities request))
+ (GET "/json/auto/list-canvassers" request (list-canvassers request))
+ (GET
+ "/json/auto/list-canvassers-by-addresse"
+ request
+ (list-canvassers-by-addresse request))
+ (GET
+ "/json/auto/list-canvassers-by-authoritie"
+ request
+ (list-canvassers-by-authoritie request))
+ (GET
+ "/json/auto/list-canvassers-by-elector"
+ request
+ (list-canvassers-by-elector request))
+ (GET "/json/auto/list-districts" request (list-districts request))
+ (GET "/json/auto/list-electors" request (list-electors request))
+ (GET
+ "/json/auto/list-electors-by-addresse"
+ request
+ (list-electors-by-addresse request))
+ (GET
+ "/json/auto/list-followupactions"
+ request
+ (list-followupactions request))
+ (GET
+ "/json/auto/list-followupactions-by-canvasser"
+ request
+ (list-followupactions-by-canvasser request))
+ (GET
+ "/json/auto/list-followupactions-by-followuprequest"
+ request
+ (list-followupactions-by-followuprequest request))
+ (GET
+ "/json/auto/list-followupmethods"
+ request
+ (list-followupmethods request))
+ (GET
+ "/json/auto/list-followuprequests"
+ request
+ (list-followuprequests request))
+ (GET
+ "/json/auto/list-followuprequests-by-elector"
+ request
+ (list-followuprequests-by-elector request))
+ (GET
+ "/json/auto/list-followuprequests-by-followupmethod"
+ request
+ (list-followuprequests-by-followupmethod request))
+ (GET
+ "/json/auto/list-followuprequests-by-issue"
+ request
+ (list-followuprequests-by-issue request))
+ (GET
+ "/json/auto/list-followuprequests-by-visit"
+ request
+ (list-followuprequests-by-visit request))
+ (GET
+ "/json/auto/list-intentions-electors-by-option"
+ request
+ (list-intentions-electors-by-option request))
+ (GET
+ "/json/auto/list-intentions-electors-by-visit"
+ request
+ (list-intentions-electors-by-visit request))
+ (GET
+ "/json/auto/list-intentions-options-by-elector"
+ request
+ (list-intentions-options-by-elector request))
+ (GET
+ "/json/auto/list-intentions-options-by-visit"
+ request
+ (list-intentions-options-by-visit request))
+ (GET
+ "/json/auto/list-intentions-visits-by-elector"
+ request
+ (list-intentions-visits-by-elector request))
+ (GET
+ "/json/auto/list-intentions-visits-by-option"
+ request
+ (list-intentions-visits-by-option request))
+ (GET
+ "/json/auto/list-issueexpertise-canvassers-by-followupmethod"
+ request
+ (list-issueexpertise-canvassers-by-followupmethod request))
+ (GET
+ "/json/auto/list-issueexpertise-canvassers-by-issue"
+ request
+ (list-issueexpertise-canvassers-by-issue request))
+ (GET
+ "/json/auto/list-issueexpertise-followupmethods-by-canvasser"
+ request
+ (list-issueexpertise-followupmethods-by-canvasser request))
+ (GET
+ "/json/auto/list-issueexpertise-followupmethods-by-issue"
+ request
+ (list-issueexpertise-followupmethods-by-issue request))
+ (GET
+ "/json/auto/list-issueexpertise-issues-by-canvasser"
+ request
+ (list-issueexpertise-issues-by-canvasser request))
+ (GET
+ "/json/auto/list-issueexpertise-issues-by-followupmethod"
+ request
+ (list-issueexpertise-issues-by-followupmethod request))
+ (GET "/json/auto/list-issues" request (list-issues request))
+ (GET "/json/auto/list-options" request (list-options request))
+ (GET
+ "/json/auto/list-rolememberships-canvassers-by-role"
+ request
+ (list-rolememberships-canvassers-by-role request))
+ (GET
+ "/json/auto/list-rolememberships-roles-by-canvasser"
+ request
+ (list-rolememberships-roles-by-canvasser request))
+ (GET "/json/auto/list-roles" request (list-roles request))
+ (GET
+ "/json/auto/list-schemamigrations"
+ request
+ (list-schemamigrations request))
+ (GET
+ "/json/auto/list-teammemberships-canvassers-by-team"
+ request
+ (list-teammemberships-canvassers-by-team request))
+ (GET
+ "/json/auto/list-teammemberships-teams-by-canvasser"
+ request
+ (list-teammemberships-teams-by-canvasser request))
+ (GET
+ "/json/auto/list-teamorganiserships-canvassers-by-team"
+ request
+ (list-teamorganiserships-canvassers-by-team request))
+ (GET
+ "/json/auto/list-teamorganiserships-teams-by-canvasser"
+ request
+ (list-teamorganiserships-teams-by-canvasser request))
+ (GET "/json/auto/list-teams" request (list-teams request))
+ (GET
+ "/json/auto/list-teams-by-district"
+ request
+ (list-teams-by-district request))
+ (GET "/json/auto/list-visits" request (list-visits request))
+ (GET
+ "/json/auto/list-visits-by-addresse"
+ request
+ (list-visits-by-addresse request))
+ (GET
+ "/json/auto/list-visits-by-canvasser"
+ request
+ (list-visits-by-canvasser request))
+ (POST "/json/auto/update-addresse" request (update-addresse request))
+ (POST
+ "/json/auto/update-canvasser"
+ request
+ (update-canvasser request))
+ (POST "/json/auto/update-district" request (update-district request))
+ (POST "/json/auto/update-elector" request (update-elector request))
+ (POST
+ "/json/auto/update-followupaction"
+ request
+ (update-followupaction request))
+ (POST
+ "/json/auto/update-followuprequest"
+ request
+ (update-followuprequest request))
+ (POST "/json/auto/update-issue" request (update-issue request))
+ (POST "/json/auto/update-visit" request (update-visit request)))
+
+
+(defn
+ create-addresse
+ "Auto-generated method to insert one record to the addresses table. Expects the following key(s) to be present in `params`: (:id :address :postcode :phone :district_id :latitude :longitude). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-addresse! params)))
+
+
+(defn
+ create-authority
+ "Auto-generated method to insert one record to the authorities table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-authority! params)))
+
+
+(defn
+ create-canvasser
+ "Auto-generated method to insert one record to the canvassers table. Expects the following key(s) to be present in `params`: (:id :username :fullname :elector_id :address_id :phone :email :authority_id :authorised). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-canvasser! params)))
+
+
+(defn
+ create-district
+ "Auto-generated method to insert one record to the districts table. Expects the following key(s) to be present in `params`: (:id :name). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-district! params)))
+
+
+(defn
+ create-elector
+ "Auto-generated method to insert one record to the electors table. Expects the following key(s) to be present in `params`: (:id :name :address_id :phone :email). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-elector! params)))
+
+
+(defn
+ create-followupaction
+ "Auto-generated method to insert one record to the followupactions table. Expects the following key(s) to be present in `params`: (:id :request_id :actor :date :notes :closed). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followupaction! params)))
+
+
+(defn
+ create-followupmethod
+ "Auto-generated method to insert one record to the followupmethods table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followupmethod! params)))
+
+
+(defn
+ create-followuprequest
+ "Auto-generated method to insert one record to the followuprequests table. Expects the following key(s) to be present in `params`: (:id :elector_id :visit_id :issue_id :method_id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followuprequest! params)))
+
+
+(defn
+ create-intention
+ "Auto-generated method to insert one record to the intentions table. Expects the following key(s) to be present in `params`: (:visit_id :elector_id :option_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-intention! params)))
+
+
+(defn
+ create-issue
+ "Auto-generated method to insert one record to the issues table. Expects the following key(s) to be present in `params`: (:id :url). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-issue! params)))
+
+
+(defn
+ create-issueexpertise
+ "Auto-generated method to insert one record to the issueexpertise table. Expects the following key(s) to be present in `params`: (:canvasser_id :issue_id :method_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-issueexpertise! params)))
+
+
+(defn
+ create-option
+ "Auto-generated method to insert one record to the options table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-option! params)))
+
+
+(defn
+ create-role
+ "Auto-generated method to insert one record to the roles table. Expects the following key(s) to be present in `params`: (:id :name). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-role! params)))
+
+
+(defn
+ create-rolemembership
+ "Auto-generated method to insert one record to the rolememberships table. Expects the following key(s) to be present in `params`: (:role_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-rolemembership! params)))
+
+
+(defn
+ create-schema-migration
+ "Auto-generated method to insert one record to the schema_migrations table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-schema-migration! params)))
+
+
+(defn
+ create-team
+ "Auto-generated method to insert one record to the teams table. Expects the following key(s) to be present in `params`: (:id :name :district_id :latitude :longitude). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-team! params)))
+
+
+(defn
+ create-teammembership
+ "Auto-generated method to insert one record to the teammemberships table. Expects the following key(s) to be present in `params`: (:team_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-teammembership! params)))
+
+
+(defn
+ create-teamorganisership
+ "Auto-generated method to insert one record to the teamorganiserships table. Expects the following key(s) to be present in `params`: (:team_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-teamorganisership! params)))
+
+
+(defn
+ create-visit
+ "Auto-generated method to insert one record to the visits table. Expects the following key(s) to be present in `params`: (:id :address_id :canvasser_id :date). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-visit! params)))
+
+
+(defn
+ delete-addresse
+ "Auto-generated method to delete one record from the addresses table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-addresse! params))
+ (response/found "/"))
+
+
+(defn
+ delete-authority
+ "Auto-generated method to delete one record from the authorities table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-authority! params))
+ (response/found "/"))
+
+
+(defn
+ delete-canvasser
+ "Auto-generated method to delete one record from the canvassers table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-canvasser! params))
+ (response/found "/"))
+
+
+(defn
+ delete-district
+ "Auto-generated method to delete one record from the districts table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-district! params))
+ (response/found "/"))
+
+
+(defn
+ delete-elector
+ "Auto-generated method to delete one record from the electors table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-elector! params))
+ (response/found "/"))
+
+
+(defn
+ delete-followupaction
+ "Auto-generated method to delete one record from the followupactions table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-followupaction! params))
+ (response/found "/"))
+
+
+(defn
+ delete-followupmethod
+ "Auto-generated method to delete one record from the followupmethods table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-followupmethod! params))
+ (response/found "/"))
+
+
+(defn
+ delete-followuprequest
+ "Auto-generated method to delete one record from the followuprequests table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-followuprequest! params))
+ (response/found "/"))
+
+
+(defn
+ delete-issue
+ "Auto-generated method to delete one record from the issues table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-issue! params))
+ (response/found "/"))
+
+
+(defn
+ delete-option
+ "Auto-generated method to delete one record from the options table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-option! params))
+ (response/found "/"))
+
+
+(defn
+ delete-visit
+ "Auto-generated method to delete one record from the visits table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-visit! params))
+ (response/found "/"))
+
+
+(defn
+ get-addresse
+ "Auto-generated method to select one record from the addresses table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address :district_id :id :latitude :longitude :phone :postcode)."
+ [{:keys [params]}]
+ (do (db/get-addresse params)))
+
+
+(defn
+ get-authority
+ "Auto-generated method to select one record from the authorities table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/get-authority params)))
+
+
+(defn
+ get-canvasser
+ "Auto-generated method to select one record from the canvassers table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
+ [{:keys [params]}]
+ (do (db/get-canvasser params)))
+
+
+(defn
+ get-district
+ "Auto-generated method to select one record from the districts table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id :name)."
+ [{:keys [params]}]
+ (do (db/get-district params)))
+
+
+(defn
+ get-elector
+ "Auto-generated method to select one record from the electors table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :email :id :name :phone)."
+ [{:keys [params]}]
+ (do (db/get-elector params)))
+
+
+(defn
+ get-followupaction
+ "Auto-generated method to select one record from the followupactions table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:actor :closed :date :id :notes :request_id)."
+ [{:keys [params]}]
+ (do (db/get-followupaction params)))
+
+
+(defn
+ get-followupmethod
+ "Auto-generated method to select one record from the followupmethods table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/get-followupmethod params)))
+
+
+(defn
+ get-followuprequest
+ "Auto-generated method to select one record from the followuprequests table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:elector_id :id :issue_id :method_id :visit_id)."
+ [{:keys [params]}]
+ (do (db/get-followuprequest params)))
+
+
+(defn
+ get-issue
+ "Auto-generated method to select one record from the issues table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id :url)."
+ [{:keys [params]}]
+ (do (db/get-issue params)))
+
+
+(defn
+ get-option
+ "Auto-generated method to select one record from the options table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/get-option params)))
+
+
+(defn
+ get-visit
+ "Auto-generated method to select one record from the visits table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :canvasser_id :date :id)."
+ [{:keys [params]}]
+ (do (db/get-visit params)))
+
+
+(defn
+ list-addresses
+ "Auto-generated method to select all records from the addresses table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address :district_id :id :latitude :longitude :phone :postcode)."
+ [{:keys [params]}]
+ (do (db/list-addresses params)))
+
+
+(defn
+ list-addresses-by-district
+ [{:keys [params]}]
+ (do (db/list-addresses-by-district params)))
+
+
+(defn
+ list-authorities
+ "Auto-generated method to select all records from the authorities table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-authorities params)))
+
+
+(defn
+ list-canvassers
+ "Auto-generated method to select all records from the canvassers table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
+ [{:keys [params]}]
+ (do (db/list-canvassers params)))
+
+
+(defn
+ list-canvassers-by-addresse
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-addresse params)))
+
+
+(defn
+ list-canvassers-by-authoritie
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-authoritie params)))
+
+
+(defn
+ list-canvassers-by-elector
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-elector params)))
+
+
+(defn
+ list-districts
+ "Auto-generated method to select all records from the districts table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :name)."
+ [{:keys [params]}]
+ (do (db/list-districts params)))
+
+
+(defn
+ list-electors
+ "Auto-generated method to select all records from the electors table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :email :id :name :phone)."
+ [{:keys [params]}]
+ (do (db/list-electors params)))
+
+
+(defn
+ list-electors-by-addresse
+ [{:keys [params]}]
+ (do (db/list-electors-by-addresse params)))
+
+
+(defn
+ list-followupactions
+ "Auto-generated method to select all records from the followupactions table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:actor :closed :date :id :notes :request_id)."
+ [{:keys [params]}]
+ (do (db/list-followupactions params)))
+
+
+(defn
+ list-followupactions-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-followupactions-by-canvasser params)))
+
+
+(defn
+ list-followupactions-by-followuprequest
+ [{:keys [params]}]
+ (do (db/list-followupactions-by-followuprequest params)))
+
+
+(defn
+ list-followupmethods
+ "Auto-generated method to select all records from the followupmethods table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-followupmethods params)))
+
+
+(defn
+ list-followuprequests
+ "Auto-generated method to select all records from the followuprequests table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:elector_id :id :issue_id :method_id :visit_id)."
+ [{:keys [params]}]
+ (do (db/list-followuprequests params)))
+
+
+(defn
+ list-followuprequests-by-elector
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-elector params)))
+
+
+(defn
+ list-followuprequests-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-followupmethod params)))
+
+
+(defn
+ list-followuprequests-by-issue
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-issue params)))
+
+
+(defn
+ list-followuprequests-by-visit
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-visit params)))
+
+
+(defn
+ list-intentions-electors-by-option
+ [{:keys [params]}]
+ (do (db/list-intentions-electors-by-option params)))
+
+
+(defn
+ list-intentions-electors-by-visit
+ [{:keys [params]}]
+ (do (db/list-intentions-electors-by-visit params)))
+
+
+(defn
+ list-intentions-options-by-elector
+ [{:keys [params]}]
+ (do (db/list-intentions-options-by-elector params)))
+
+
+(defn
+ list-intentions-options-by-visit
+ [{:keys [params]}]
+ (do (db/list-intentions-options-by-visit params)))
+
+
+(defn
+ list-intentions-visits-by-elector
+ [{:keys [params]}]
+ (do (db/list-intentions-visits-by-elector params)))
+
+
+(defn
+ list-intentions-visits-by-option
+ [{:keys [params]}]
+ (do (db/list-intentions-visits-by-option params)))
+
+
+(defn
+ list-issueexpertise-canvassers-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-canvassers-by-followupmethod params)))
+
+
+(defn
+ list-issueexpertise-canvassers-by-issue
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-canvassers-by-issue params)))
+
+
+(defn
+ list-issueexpertise-followupmethods-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-followupmethods-by-canvasser params)))
+
+
+(defn
+ list-issueexpertise-followupmethods-by-issue
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-followupmethods-by-issue params)))
+
+
+(defn
+ list-issueexpertise-issues-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-issues-by-canvasser params)))
+
+
+(defn
+ list-issueexpertise-issues-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-issues-by-followupmethod params)))
+
+
+(defn
+ list-issues
+ "Auto-generated method to select all records from the issues table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :url)."
+ [{:keys [params]}]
+ (do (db/list-issues params)))
+
+
+(defn
+ list-options
+ "Auto-generated method to select all records from the options table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-options params)))
+
+
+(defn
+ list-rolememberships-canvassers-by-role
+ [{:keys [params]}]
+ (do (db/list-rolememberships-canvassers-by-role params)))
+
+
+(defn
+ list-rolememberships-roles-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-rolememberships-roles-by-canvasser params)))
+
+
+(defn
+ list-roles
+ "Auto-generated method to select all records from the roles table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :name)."
+ [{:keys [params]}]
+ (do (db/list-roles params)))
+
+
+(defn
+ list-schemamigrations
+ "Auto-generated method to select all records from the schema_migrations table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-schema_migrations params)))
+
+
+(defn
+ list-teammemberships-canvassers-by-team
+ [{:keys [params]}]
+ (do (db/list-teammemberships-canvassers-by-team params)))
+
+
+(defn
+ list-teammemberships-teams-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teammemberships-teams-by-canvasser params)))
+
+
+(defn
+ list-teamorganiserships-canvassers-by-team
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships-canvassers-by-team params)))
+
+
+(defn
+ list-teamorganiserships-teams-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships-teams-by-canvasser params)))
+
+
+(defn
+ list-teams
+ "Auto-generated method to select all records from the teams table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:district_id :id :latitude :longitude :name)."
+ [{:keys [params]}]
+ (do (db/list-teams params)))
+
+
+(defn
+ list-teams-by-district
+ [{:keys [params]}]
+ (do (db/list-teams-by-district params)))
+
+
+(defn
+ list-visits
+ "Auto-generated method to select all records from the visits table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :canvasser_id :date :id)."
+ [{:keys [params]}]
+ (do (db/list-visits params)))
+
+
+(defn
+ list-visits-by-addresse
+ [{:keys [params]}]
+ (do (db/list-visits-by-addresse params)))
+
+
+(defn
+ list-visits-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-visits-by-canvasser params)))
+
+
+(defn
+ update-addresse
+ "Auto-generated method to update one record in the addresses table. Expects the following key(s) to be present in `params`: (:address :district_id :id :latitude :longitude :phone :postcode)."
+ [{:keys [params]}]
+ (do (db/update-addresse! params))
+ (response/found "/"))
+
+
+(defn
+ update-canvasser
+ "Auto-generated method to update one record in the canvassers table. Expects the following key(s) to be present in `params`: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
+ [{:keys [params]}]
+ (do (db/update-canvasser! params))
+ (response/found "/"))
+
+
+(defn
+ update-district
+ "Auto-generated method to update one record in the districts table. Expects the following key(s) to be present in `params`: (:id :name)."
+ [{:keys [params]}]
+ (do (db/update-district! params))
+ (response/found "/"))
+
+
+(defn
+ update-elector
+ "Auto-generated method to update one record in the electors table. Expects the following key(s) to be present in `params`: (:address_id :email :id :name :phone)."
+ [{:keys [params]}]
+ (do (db/update-elector! params))
+ (response/found "/"))
+
+
+(defn
+ update-followupaction
+ "Auto-generated method to update one record in the followupactions table. Expects the following key(s) to be present in `params`: (:actor :closed :date :id :notes :request_id)."
+ [{:keys [params]}]
+ (do (db/update-followupaction! params))
+ (response/found "/"))
+
+
+(defn
+ update-followuprequest
+ "Auto-generated method to update one record in the followuprequests table. Expects the following key(s) to be present in `params`: (:elector_id :id :issue_id :method_id :visit_id)."
+ [{:keys [params]}]
+ (do (db/update-followuprequest! params))
+ (response/found "/"))
+
+
+(defn
+ update-issue
+ "Auto-generated method to update one record in the issues table. Expects the following key(s) to be present in `params`: (:id :url)."
+ [{:keys [params]}]
+ (do (db/update-issue! params))
+ (response/found "/"))
+
+
+(defn
+ update-visit
+ "Auto-generated method to update one record in the visits table. Expects the following key(s) to be present in `params`: (:address_id :canvasser_id :date :id)."
+ [{:keys [params]}]
+ (do (db/update-visit! params))
+ (response/found "/"))
+
+
diff --git a/src/clj/youyesyet/routes/rest.clj b/src/clj/youyesyet/routes/rest.clj
index 6ca9b3f..c164b9b 100644
--- a/src/clj/youyesyet/routes/rest.clj
+++ b/src/clj/youyesyet/routes/rest.clj
@@ -40,7 +40,7 @@
(defn get-issues
"Get current issues. No arguments expected."
- [request]
+ [request])
(defroutes rest-routes
(GET "/rest/get-local-data" request (route/restricted (get-local-data request)))
From f23e52a65bebb2ec08146fbc484ccbb1c8671c67 Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Sat, 17 Mar 2018 18:33:06 +0000
Subject: [PATCH 05/51] Squirrel-parse generated routes and queries are now
working
Routes and queries auto-generated from migrations by [squirrel-parse](https://github.com/simon-brooke/squirrel-parse) are now actually working!
---
.../entity-relationship-diagram.svg | 10 +-
.../20161014170335-basic-setup.up.sql | 4 +-
...0316110100-intentions-and-options.down.sql | 24 +
...180316110100-intentions-and-options.up.sql | 30 +
.../migrations/20180317170000-gender.down.sql | 3 +
.../migrations/20180317170000-gender.up.sql | 11 +
.../20180317170907-reference-data.down.sql | 10 +
.../20180317170907-reference-data.up.sql | 10 +
.../20180317175047-test-data.down.sql | 3 +
.../20180317175047-test-data.up.sql | 41 +
resources/sql/queries.auto.sql | 735 ++++++++++++
src/clj/youyesyet/db/core.clj | 14 +-
src/clj/youyesyet/handler.clj | 7 +-
src/clj/youyesyet/routes/auto_json_routes.clj | 1035 +++++++++++++++++
src/clj/youyesyet/routes/rest.clj | 2 +-
15 files changed, 1923 insertions(+), 16 deletions(-)
create mode 100644 resources/migrations/20180316110100-intentions-and-options.down.sql
create mode 100644 resources/migrations/20180316110100-intentions-and-options.up.sql
create mode 100644 resources/migrations/20180317170000-gender.down.sql
create mode 100644 resources/migrations/20180317170000-gender.up.sql
create mode 100644 resources/migrations/20180317170907-reference-data.down.sql
create mode 100644 resources/migrations/20180317170907-reference-data.up.sql
create mode 100644 resources/migrations/20180317175047-test-data.down.sql
create mode 100644 resources/migrations/20180317175047-test-data.up.sql
create mode 100644 resources/sql/queries.auto.sql
create mode 100644 src/clj/youyesyet/routes/auto_json_routes.clj
diff --git a/doc/specification/entity-relationship-diagram.svg b/doc/specification/entity-relationship-diagram.svg
index 0de6cf0..dbb5475 100644
--- a/doc/specification/entity-relationship-diagram.svg
+++ b/doc/specification/entity-relationship-diagram.svg
@@ -25,9 +25,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.979899"
- inkscape:cx="833.70674"
- inkscape:cy="324.89697"
+ inkscape:zoom="0.9899495"
+ inkscape:cx="472.36875"
+ inkscape:cy="325.73865"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -62,8 +62,8 @@
id="rect4428"
width="1030"
height="730"
- x="232.23355"
- y="376.0018" />
+ x="16.060907"
+ y="312.36218" />
sql-date (.getTime) (java.util.Date.)))
diff --git a/src/clj/youyesyet/handler.clj b/src/clj/youyesyet/handler.clj
index f898fe5..bc67a8c 100644
--- a/src/clj/youyesyet/handler.clj
+++ b/src/clj/youyesyet/handler.clj
@@ -3,6 +3,7 @@
[youyesyet.layout :refer [error-page]]
[youyesyet.routes.home :refer [home-routes]]
[youyesyet.routes.oauth :refer [oauth-routes]]
+ [youyesyet.routes.auto-json-routes :refer [auto-rest-routes]]
[compojure.route :as route]
[youyesyet.env :refer [defaults]]
[mount.core :as mount]
@@ -37,6 +38,9 @@
(-> #'home-routes
(wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats))
+ (-> #'auto-rest-routes
+ (wrap-routes middleware/wrap-csrf)
+ (wrap-routes middleware/wrap-formats))
#'oauth-routes
(route/not-found
(:body
@@ -44,4 +48,5 @@
:title "page not found"})))))
-(def app (middleware/wrap-base #'app-routes))
+(def app #'app-routes)
+ ;;(middleware/wrap-base #'app-routes))
diff --git a/src/clj/youyesyet/routes/auto_json_routes.clj b/src/clj/youyesyet/routes/auto_json_routes.clj
new file mode 100644
index 0000000..8d3d707
--- /dev/null
+++ b/src/clj/youyesyet/routes/auto_json_routes.clj
@@ -0,0 +1,1035 @@
+(ns
+ youyesyet.routes.auto-json-routes
+ (require
+ [noir.response :as nresponse]
+ [noir.util.route :as route]
+ [compojure.core :refer [defroutes GET POST]]
+ [ring.util.http-response :as response]
+ [clojure.java.io :as io]
+ [hugsql.core :as hugsql]
+ [youyesyet.db.core :as db]))
+
+
+(declare
+ create-addresse
+ create-authority
+ create-canvasser
+ create-district
+ create-elector
+ create-followupaction
+ create-followupmethod
+ create-followuprequest
+ create-intention
+ create-issue
+ create-issueexpertise
+ create-option
+ create-role
+ create-rolemembership
+ create-schema-migration
+ create-team
+ create-teammembership
+ create-teamorganisership
+ create-visit
+ delete-addresse
+ delete-authority
+ delete-canvasser
+ delete-district
+ delete-elector
+ delete-followupaction
+ delete-followupmethod
+ delete-followuprequest
+ delete-issue
+ delete-option
+ delete-visit
+ get-addresse
+ get-authority
+ get-canvasser
+ get-district
+ get-elector
+ get-followupaction
+ get-followupmethod
+ get-followuprequest
+ get-issue
+ get-option
+ get-visit
+ list-addresses
+ list-addresses-by-district
+ list-authorities
+ list-canvassers
+ list-canvassers-by-addresse
+ list-canvassers-by-authoritie
+ list-canvassers-by-elector
+ list-districts
+ list-electors
+ list-electors-by-addresse
+ list-followupactions
+ list-followupactions-by-canvasser
+ list-followupactions-by-followuprequest
+ list-followupmethods
+ list-followuprequests
+ list-followuprequests-by-elector
+ list-followuprequests-by-followupmethod
+ list-followuprequests-by-issue
+ list-followuprequests-by-visit
+ list-intentions-electors-by-option
+ list-intentions-electors-by-visit
+ list-intentions-options-by-elector
+ list-intentions-options-by-visit
+ list-intentions-visits-by-elector
+ list-intentions-visits-by-option
+ list-issueexpertise-canvassers-by-followupmethod
+ list-issueexpertise-canvassers-by-issue
+ list-issueexpertise-followupmethods-by-canvasser
+ list-issueexpertise-followupmethods-by-issue
+ list-issueexpertise-issues-by-canvasser
+ list-issueexpertise-issues-by-followupmethod
+ list-issues
+ list-options
+ list-rolememberships-canvassers-by-role
+ list-rolememberships-roles-by-canvasser
+ list-roles
+ list-schemamigrations
+ list-teammemberships-canvassers-by-team
+ list-teammemberships-teams-by-canvasser
+ list-teamorganiserships-canvassers-by-team
+ list-teamorganiserships-teams-by-canvasser
+ list-teams
+ list-teams-by-district
+ list-visits
+ list-visits-by-addresse
+ list-visits-by-canvasser
+ update-addresse
+ update-canvasser
+ update-district
+ update-elector
+ update-followupaction
+ update-followuprequest
+ update-issue
+ update-visit)
+
+
+(defroutes
+ auto-rest-routes
+ (POST "/json/auto/create-addresse" request (create-addresse request))
+ (POST
+ "/json/auto/create-authority"
+ request
+ (create-authority request))
+ (POST
+ "/json/auto/create-canvasser"
+ request
+ (create-canvasser request))
+ (POST "/json/auto/create-district" request (create-district request))
+ (POST "/json/auto/create-elector" request (create-elector request))
+ (POST
+ "/json/auto/create-followupaction"
+ request
+ (create-followupaction request))
+ (POST
+ "/json/auto/create-followupmethod"
+ request
+ (create-followupmethod request))
+ (POST
+ "/json/auto/create-followuprequest"
+ request
+ (create-followuprequest request))
+ (POST
+ "/json/auto/create-intention"
+ request
+ (create-intention request))
+ (POST "/json/auto/create-issue" request (create-issue request))
+ (POST
+ "/json/auto/create-issueexpertise"
+ request
+ (create-issueexpertise request))
+ (POST "/json/auto/create-option" request (create-option request))
+ (POST "/json/auto/create-role" request (create-role request))
+ (POST
+ "/json/auto/create-rolemembership"
+ request
+ (create-rolemembership request))
+ (POST
+ "/json/auto/create-schema-migration"
+ request
+ (create-schema-migration request))
+ (POST "/json/auto/create-team" request (create-team request))
+ (POST
+ "/json/auto/create-teammembership"
+ request
+ (create-teammembership request))
+ (POST
+ "/json/auto/create-teamorganisership"
+ request
+ (create-teamorganisership request))
+ (POST "/json/auto/create-visit" request (create-visit request))
+ (POST "/json/auto/delete-addresse" request (delete-addresse request))
+ (POST
+ "/json/auto/delete-authority"
+ request
+ (delete-authority request))
+ (POST
+ "/json/auto/delete-canvasser"
+ request
+ (delete-canvasser request))
+ (POST "/json/auto/delete-district" request (delete-district request))
+ (POST "/json/auto/delete-elector" request (delete-elector request))
+ (POST
+ "/json/auto/delete-followupaction"
+ request
+ (delete-followupaction request))
+ (POST
+ "/json/auto/delete-followupmethod"
+ request
+ (delete-followupmethod request))
+ (POST
+ "/json/auto/delete-followuprequest"
+ request
+ (delete-followuprequest request))
+ (POST "/json/auto/delete-issue" request (delete-issue request))
+ (POST "/json/auto/delete-option" request (delete-option request))
+ (POST "/json/auto/delete-visit" request (delete-visit request))
+ (POST "/json/auto/get-addresse" request (get-addresse request))
+ (POST "/json/auto/get-authority" request (get-authority request))
+ (POST "/json/auto/get-canvasser" request (get-canvasser request))
+ (POST "/json/auto/get-district" request (get-district request))
+ (POST "/json/auto/get-elector" request (get-elector request))
+ (POST
+ "/json/auto/get-followupaction"
+ request
+ (get-followupaction request))
+ (POST
+ "/json/auto/get-followupmethod"
+ request
+ (get-followupmethod request))
+ (POST
+ "/json/auto/get-followuprequest"
+ request
+ (get-followuprequest request))
+ (POST "/json/auto/get-issue" request (get-issue request))
+ (POST "/json/auto/get-option" request (get-option request))
+ (POST "/json/auto/get-visit" request (get-visit request))
+ (GET "/json/auto/list-addresses" request (list-addresses request))
+ (GET
+ "/json/auto/list-addresses-by-district"
+ request
+ (list-addresses-by-district request))
+ (GET "/json/auto/list-authorities" request (list-authorities request))
+ (GET "/json/auto/list-canvassers" request (list-canvassers request))
+ (GET
+ "/json/auto/list-canvassers-by-addresse"
+ request
+ (list-canvassers-by-addresse request))
+ (GET
+ "/json/auto/list-canvassers-by-authoritie"
+ request
+ (list-canvassers-by-authoritie request))
+ (GET
+ "/json/auto/list-canvassers-by-elector"
+ request
+ (list-canvassers-by-elector request))
+ (GET "/json/auto/list-districts" request (list-districts request))
+ (GET "/json/auto/list-electors" request (list-electors request))
+ (GET
+ "/json/auto/list-electors-by-addresse"
+ request
+ (list-electors-by-addresse request))
+ (GET
+ "/json/auto/list-followupactions"
+ request
+ (list-followupactions request))
+ (GET
+ "/json/auto/list-followupactions-by-canvasser"
+ request
+ (list-followupactions-by-canvasser request))
+ (GET
+ "/json/auto/list-followupactions-by-followuprequest"
+ request
+ (list-followupactions-by-followuprequest request))
+ (GET
+ "/json/auto/list-followupmethods"
+ request
+ (list-followupmethods request))
+ (GET
+ "/json/auto/list-followuprequests"
+ request
+ (list-followuprequests request))
+ (GET
+ "/json/auto/list-followuprequests-by-elector"
+ request
+ (list-followuprequests-by-elector request))
+ (GET
+ "/json/auto/list-followuprequests-by-followupmethod"
+ request
+ (list-followuprequests-by-followupmethod request))
+ (GET
+ "/json/auto/list-followuprequests-by-issue"
+ request
+ (list-followuprequests-by-issue request))
+ (GET
+ "/json/auto/list-followuprequests-by-visit"
+ request
+ (list-followuprequests-by-visit request))
+ (GET
+ "/json/auto/list-intentions-electors-by-option"
+ request
+ (list-intentions-electors-by-option request))
+ (GET
+ "/json/auto/list-intentions-electors-by-visit"
+ request
+ (list-intentions-electors-by-visit request))
+ (GET
+ "/json/auto/list-intentions-options-by-elector"
+ request
+ (list-intentions-options-by-elector request))
+ (GET
+ "/json/auto/list-intentions-options-by-visit"
+ request
+ (list-intentions-options-by-visit request))
+ (GET
+ "/json/auto/list-intentions-visits-by-elector"
+ request
+ (list-intentions-visits-by-elector request))
+ (GET
+ "/json/auto/list-intentions-visits-by-option"
+ request
+ (list-intentions-visits-by-option request))
+ (GET
+ "/json/auto/list-issueexpertise-canvassers-by-followupmethod"
+ request
+ (list-issueexpertise-canvassers-by-followupmethod request))
+ (GET
+ "/json/auto/list-issueexpertise-canvassers-by-issue"
+ request
+ (list-issueexpertise-canvassers-by-issue request))
+ (GET
+ "/json/auto/list-issueexpertise-followupmethods-by-canvasser"
+ request
+ (list-issueexpertise-followupmethods-by-canvasser request))
+ (GET
+ "/json/auto/list-issueexpertise-followupmethods-by-issue"
+ request
+ (list-issueexpertise-followupmethods-by-issue request))
+ (GET
+ "/json/auto/list-issueexpertise-issues-by-canvasser"
+ request
+ (list-issueexpertise-issues-by-canvasser request))
+ (GET
+ "/json/auto/list-issueexpertise-issues-by-followupmethod"
+ request
+ (list-issueexpertise-issues-by-followupmethod request))
+ (GET "/json/auto/list-issues" request (list-issues request))
+ (GET "/json/auto/list-options" request (list-options request))
+ (GET
+ "/json/auto/list-rolememberships-canvassers-by-role"
+ request
+ (list-rolememberships-canvassers-by-role request))
+ (GET
+ "/json/auto/list-rolememberships-roles-by-canvasser"
+ request
+ (list-rolememberships-roles-by-canvasser request))
+ (GET "/json/auto/list-roles" request (list-roles request))
+ (GET
+ "/json/auto/list-schemamigrations"
+ request
+ (list-schemamigrations request))
+ (GET
+ "/json/auto/list-teammemberships-canvassers-by-team"
+ request
+ (list-teammemberships-canvassers-by-team request))
+ (GET
+ "/json/auto/list-teammemberships-teams-by-canvasser"
+ request
+ (list-teammemberships-teams-by-canvasser request))
+ (GET
+ "/json/auto/list-teamorganiserships-canvassers-by-team"
+ request
+ (list-teamorganiserships-canvassers-by-team request))
+ (GET
+ "/json/auto/list-teamorganiserships-teams-by-canvasser"
+ request
+ (list-teamorganiserships-teams-by-canvasser request))
+ (GET "/json/auto/list-teams" request (list-teams request))
+ (GET
+ "/json/auto/list-teams-by-district"
+ request
+ (list-teams-by-district request))
+ (GET "/json/auto/list-visits" request (list-visits request))
+ (GET
+ "/json/auto/list-visits-by-addresse"
+ request
+ (list-visits-by-addresse request))
+ (GET
+ "/json/auto/list-visits-by-canvasser"
+ request
+ (list-visits-by-canvasser request))
+ (POST "/json/auto/update-addresse" request (update-addresse request))
+ (POST
+ "/json/auto/update-canvasser"
+ request
+ (update-canvasser request))
+ (POST "/json/auto/update-district" request (update-district request))
+ (POST "/json/auto/update-elector" request (update-elector request))
+ (POST
+ "/json/auto/update-followupaction"
+ request
+ (update-followupaction request))
+ (POST
+ "/json/auto/update-followuprequest"
+ request
+ (update-followuprequest request))
+ (POST "/json/auto/update-issue" request (update-issue request))
+ (POST "/json/auto/update-visit" request (update-visit request)))
+
+
+(defn
+ create-addresse
+ "Auto-generated method to insert one record to the addresses table. Expects the following key(s) to be present in `params`: (:id :address :postcode :phone :district_id :latitude :longitude). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-addresse! params)))
+
+
+(defn
+ create-authority
+ "Auto-generated method to insert one record to the authorities table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-authority! params)))
+
+
+(defn
+ create-canvasser
+ "Auto-generated method to insert one record to the canvassers table. Expects the following key(s) to be present in `params`: (:id :username :fullname :elector_id :address_id :phone :email :authority_id :authorised). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-canvasser! params)))
+
+
+(defn
+ create-district
+ "Auto-generated method to insert one record to the districts table. Expects the following key(s) to be present in `params`: (:id :name). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-district! params)))
+
+
+(defn
+ create-elector
+ "Auto-generated method to insert one record to the electors table. Expects the following key(s) to be present in `params`: (:id :name :address_id :phone :email). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-elector! params)))
+
+
+(defn
+ create-followupaction
+ "Auto-generated method to insert one record to the followupactions table. Expects the following key(s) to be present in `params`: (:id :request_id :actor :date :notes :closed). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followupaction! params)))
+
+
+(defn
+ create-followupmethod
+ "Auto-generated method to insert one record to the followupmethods table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followupmethod! params)))
+
+
+(defn
+ create-followuprequest
+ "Auto-generated method to insert one record to the followuprequests table. Expects the following key(s) to be present in `params`: (:id :elector_id :visit_id :issue_id :method_id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followuprequest! params)))
+
+
+(defn
+ create-intention
+ "Auto-generated method to insert one record to the intentions table. Expects the following key(s) to be present in `params`: (:visit_id :elector_id :option_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-intention! params)))
+
+
+(defn
+ create-issue
+ "Auto-generated method to insert one record to the issues table. Expects the following key(s) to be present in `params`: (:id :url). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-issue! params)))
+
+
+(defn
+ create-issueexpertise
+ "Auto-generated method to insert one record to the issueexpertise table. Expects the following key(s) to be present in `params`: (:canvasser_id :issue_id :method_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-issueexpertise! params)))
+
+
+(defn
+ create-option
+ "Auto-generated method to insert one record to the options table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-option! params)))
+
+
+(defn
+ create-role
+ "Auto-generated method to insert one record to the roles table. Expects the following key(s) to be present in `params`: (:id :name). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-role! params)))
+
+
+(defn
+ create-rolemembership
+ "Auto-generated method to insert one record to the rolememberships table. Expects the following key(s) to be present in `params`: (:role_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-rolemembership! params)))
+
+
+(defn
+ create-schema-migration
+ "Auto-generated method to insert one record to the schema_migrations table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-schema-migration! params)))
+
+
+(defn
+ create-team
+ "Auto-generated method to insert one record to the teams table. Expects the following key(s) to be present in `params`: (:id :name :district_id :latitude :longitude). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-team! params)))
+
+
+(defn
+ create-teammembership
+ "Auto-generated method to insert one record to the teammemberships table. Expects the following key(s) to be present in `params`: (:team_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-teammembership! params)))
+
+
+(defn
+ create-teamorganisership
+ "Auto-generated method to insert one record to the teamorganiserships table. Expects the following key(s) to be present in `params`: (:team_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-teamorganisership! params)))
+
+
+(defn
+ create-visit
+ "Auto-generated method to insert one record to the visits table. Expects the following key(s) to be present in `params`: (:id :address_id :canvasser_id :date). Returns a map containing the keys (:id) identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-visit! params)))
+
+
+(defn
+ delete-addresse
+ "Auto-generated method to delete one record from the addresses table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-addresse! params))
+ (response/found "/"))
+
+
+(defn
+ delete-authority
+ "Auto-generated method to delete one record from the authorities table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-authority! params))
+ (response/found "/"))
+
+
+(defn
+ delete-canvasser
+ "Auto-generated method to delete one record from the canvassers table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-canvasser! params))
+ (response/found "/"))
+
+
+(defn
+ delete-district
+ "Auto-generated method to delete one record from the districts table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-district! params))
+ (response/found "/"))
+
+
+(defn
+ delete-elector
+ "Auto-generated method to delete one record from the electors table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-elector! params))
+ (response/found "/"))
+
+
+(defn
+ delete-followupaction
+ "Auto-generated method to delete one record from the followupactions table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-followupaction! params))
+ (response/found "/"))
+
+
+(defn
+ delete-followupmethod
+ "Auto-generated method to delete one record from the followupmethods table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-followupmethod! params))
+ (response/found "/"))
+
+
+(defn
+ delete-followuprequest
+ "Auto-generated method to delete one record from the followuprequests table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-followuprequest! params))
+ (response/found "/"))
+
+
+(defn
+ delete-issue
+ "Auto-generated method to delete one record from the issues table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-issue! params))
+ (response/found "/"))
+
+
+(defn
+ delete-option
+ "Auto-generated method to delete one record from the options table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-option! params))
+ (response/found "/"))
+
+
+(defn
+ delete-visit
+ "Auto-generated method to delete one record from the visits table. Expects the following key(s) to be present in `params`: (:id)."
+ [{:keys [params]}]
+ (do (db/delete-visit! params))
+ (response/found "/"))
+
+
+(defn
+ get-addresse
+ "Auto-generated method to select one record from the addresses table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address :district_id :id :latitude :longitude :phone :postcode)."
+ [{:keys [params]}]
+ (do (db/get-addresse params)))
+
+
+(defn
+ get-authority
+ "Auto-generated method to select one record from the authorities table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/get-authority params)))
+
+
+(defn
+ get-canvasser
+ "Auto-generated method to select one record from the canvassers table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
+ [{:keys [params]}]
+ (do (db/get-canvasser params)))
+
+
+(defn
+ get-district
+ "Auto-generated method to select one record from the districts table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id :name)."
+ [{:keys [params]}]
+ (do (db/get-district params)))
+
+
+(defn
+ get-elector
+ "Auto-generated method to select one record from the electors table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :email :id :name :phone)."
+ [{:keys [params]}]
+ (do (db/get-elector params)))
+
+
+(defn
+ get-followupaction
+ "Auto-generated method to select one record from the followupactions table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:actor :closed :date :id :notes :request_id)."
+ [{:keys [params]}]
+ (do (db/get-followupaction params)))
+
+
+(defn
+ get-followupmethod
+ "Auto-generated method to select one record from the followupmethods table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/get-followupmethod params)))
+
+
+(defn
+ get-followuprequest
+ "Auto-generated method to select one record from the followuprequests table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:elector_id :id :issue_id :method_id :visit_id)."
+ [{:keys [params]}]
+ (do (db/get-followuprequest params)))
+
+
+(defn
+ get-issue
+ "Auto-generated method to select one record from the issues table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id :url)."
+ [{:keys [params]}]
+ (do (db/get-issue params)))
+
+
+(defn
+ get-option
+ "Auto-generated method to select one record from the options table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/get-option params)))
+
+
+(defn
+ get-visit
+ "Auto-generated method to select one record from the visits table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :canvasser_id :date :id)."
+ [{:keys [params]}]
+ (do (db/get-visit params)))
+
+
+(defn
+ list-addresses
+ "Auto-generated method to select all records from the addresses table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address :district_id :id :latitude :longitude :phone :postcode)."
+ [{:keys [params]}]
+ (do (db/list-addresses params)))
+
+
+(defn
+ list-addresses-by-district
+ [{:keys [params]}]
+ (do (db/list-addresses-by-district params)))
+
+
+(defn
+ list-authorities
+ "Auto-generated method to select all records from the authorities table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-authorities params)))
+
+
+(defn
+ list-canvassers
+ "Auto-generated method to select all records from the canvassers table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
+ [{:keys [params]}]
+ (do (db/list-canvassers params)))
+
+
+(defn
+ list-canvassers-by-addresse
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-addresse params)))
+
+
+(defn
+ list-canvassers-by-authoritie
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-authoritie params)))
+
+
+(defn
+ list-canvassers-by-elector
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-elector params)))
+
+
+(defn
+ list-districts
+ "Auto-generated method to select all records from the districts table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :name)."
+ [{:keys [params]}]
+ (do (db/list-districts params)))
+
+
+(defn
+ list-electors
+ "Auto-generated method to select all records from the electors table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :email :id :name :phone)."
+ [{:keys [params]}]
+ (do (db/list-electors params)))
+
+
+(defn
+ list-electors-by-addresse
+ [{:keys [params]}]
+ (do (db/list-electors-by-addresse params)))
+
+
+(defn
+ list-followupactions
+ "Auto-generated method to select all records from the followupactions table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:actor :closed :date :id :notes :request_id)."
+ [{:keys [params]}]
+ (do (db/list-followupactions params)))
+
+
+(defn
+ list-followupactions-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-followupactions-by-canvasser params)))
+
+
+(defn
+ list-followupactions-by-followuprequest
+ [{:keys [params]}]
+ (do (db/list-followupactions-by-followuprequest params)))
+
+
+(defn
+ list-followupmethods
+ "Auto-generated method to select all records from the followupmethods table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-followupmethods params)))
+
+
+(defn
+ list-followuprequests
+ "Auto-generated method to select all records from the followuprequests table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:elector_id :id :issue_id :method_id :visit_id)."
+ [{:keys [params]}]
+ (do (db/list-followuprequests params)))
+
+
+(defn
+ list-followuprequests-by-elector
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-elector params)))
+
+
+(defn
+ list-followuprequests-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-followupmethod params)))
+
+
+(defn
+ list-followuprequests-by-issue
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-issue params)))
+
+
+(defn
+ list-followuprequests-by-visit
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-visit params)))
+
+
+(defn
+ list-intentions-electors-by-option
+ [{:keys [params]}]
+ (do (db/list-intentions-electors-by-option params)))
+
+
+(defn
+ list-intentions-electors-by-visit
+ [{:keys [params]}]
+ (do (db/list-intentions-electors-by-visit params)))
+
+
+(defn
+ list-intentions-options-by-elector
+ [{:keys [params]}]
+ (do (db/list-intentions-options-by-elector params)))
+
+
+(defn
+ list-intentions-options-by-visit
+ [{:keys [params]}]
+ (do (db/list-intentions-options-by-visit params)))
+
+
+(defn
+ list-intentions-visits-by-elector
+ [{:keys [params]}]
+ (do (db/list-intentions-visits-by-elector params)))
+
+
+(defn
+ list-intentions-visits-by-option
+ [{:keys [params]}]
+ (do (db/list-intentions-visits-by-option params)))
+
+
+(defn
+ list-issueexpertise-canvassers-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-canvassers-by-followupmethod params)))
+
+
+(defn
+ list-issueexpertise-canvassers-by-issue
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-canvassers-by-issue params)))
+
+
+(defn
+ list-issueexpertise-followupmethods-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-followupmethods-by-canvasser params)))
+
+
+(defn
+ list-issueexpertise-followupmethods-by-issue
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-followupmethods-by-issue params)))
+
+
+(defn
+ list-issueexpertise-issues-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-issues-by-canvasser params)))
+
+
+(defn
+ list-issueexpertise-issues-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-issues-by-followupmethod params)))
+
+
+(defn
+ list-issues
+ "Auto-generated method to select all records from the issues table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :url)."
+ [{:keys [params]}]
+ (do (db/list-issues params)))
+
+
+(defn
+ list-options
+ "Auto-generated method to select all records from the options table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-options params)))
+
+
+(defn
+ list-rolememberships-canvassers-by-role
+ [{:keys [params]}]
+ (do (db/list-rolememberships-canvassers-by-role params)))
+
+
+(defn
+ list-rolememberships-roles-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-rolememberships-roles-by-canvasser params)))
+
+
+(defn
+ list-roles
+ "Auto-generated method to select all records from the roles table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :name)."
+ [{:keys [params]}]
+ (do (db/list-roles params)))
+
+
+(defn
+ list-schemamigrations
+ "Auto-generated method to select all records from the schema_migrations table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
+ [{:keys [params]}]
+ (do (db/list-schema_migrations params)))
+
+
+(defn
+ list-teammemberships-canvassers-by-team
+ [{:keys [params]}]
+ (do (db/list-teammemberships-canvassers-by-team params)))
+
+
+(defn
+ list-teammemberships-teams-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teammemberships-teams-by-canvasser params)))
+
+
+(defn
+ list-teamorganiserships-canvassers-by-team
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships-canvassers-by-team params)))
+
+
+(defn
+ list-teamorganiserships-teams-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships-teams-by-canvasser params)))
+
+
+(defn
+ list-teams
+ "Auto-generated method to select all records from the teams table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:district_id :id :latitude :longitude :name)."
+ [{:keys [params]}]
+ (do (db/list-teams params)))
+
+
+(defn
+ list-teams-by-district
+ [{:keys [params]}]
+ (do (db/list-teams-by-district params)))
+
+
+(defn
+ list-visits
+ "Auto-generated method to select all records from the visits table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :canvasser_id :date :id)."
+ [{:keys [params]}]
+ (do (db/list-visits params)))
+
+
+(defn
+ list-visits-by-addresse
+ [{:keys [params]}]
+ (do (db/list-visits-by-addresse params)))
+
+
+(defn
+ list-visits-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-visits-by-canvasser params)))
+
+
+(defn
+ update-addresse
+ "Auto-generated method to update one record in the addresses table. Expects the following key(s) to be present in `params`: (:address :district_id :id :latitude :longitude :phone :postcode)."
+ [{:keys [params]}]
+ (do (db/update-addresse! params))
+ (response/found "/"))
+
+
+(defn
+ update-canvasser
+ "Auto-generated method to update one record in the canvassers table. Expects the following key(s) to be present in `params`: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
+ [{:keys [params]}]
+ (do (db/update-canvasser! params))
+ (response/found "/"))
+
+
+(defn
+ update-district
+ "Auto-generated method to update one record in the districts table. Expects the following key(s) to be present in `params`: (:id :name)."
+ [{:keys [params]}]
+ (do (db/update-district! params))
+ (response/found "/"))
+
+
+(defn
+ update-elector
+ "Auto-generated method to update one record in the electors table. Expects the following key(s) to be present in `params`: (:address_id :email :id :name :phone)."
+ [{:keys [params]}]
+ (do (db/update-elector! params))
+ (response/found "/"))
+
+
+(defn
+ update-followupaction
+ "Auto-generated method to update one record in the followupactions table. Expects the following key(s) to be present in `params`: (:actor :closed :date :id :notes :request_id)."
+ [{:keys [params]}]
+ (do (db/update-followupaction! params))
+ (response/found "/"))
+
+
+(defn
+ update-followuprequest
+ "Auto-generated method to update one record in the followuprequests table. Expects the following key(s) to be present in `params`: (:elector_id :id :issue_id :method_id :visit_id)."
+ [{:keys [params]}]
+ (do (db/update-followuprequest! params))
+ (response/found "/"))
+
+
+(defn
+ update-issue
+ "Auto-generated method to update one record in the issues table. Expects the following key(s) to be present in `params`: (:id :url)."
+ [{:keys [params]}]
+ (do (db/update-issue! params))
+ (response/found "/"))
+
+
+(defn
+ update-visit
+ "Auto-generated method to update one record in the visits table. Expects the following key(s) to be present in `params`: (:address_id :canvasser_id :date :id)."
+ [{:keys [params]}]
+ (do (db/update-visit! params))
+ (response/found "/"))
+
+
diff --git a/src/clj/youyesyet/routes/rest.clj b/src/clj/youyesyet/routes/rest.clj
index 6ca9b3f..c164b9b 100644
--- a/src/clj/youyesyet/routes/rest.clj
+++ b/src/clj/youyesyet/routes/rest.clj
@@ -40,7 +40,7 @@
(defn get-issues
"Get current issues. No arguments expected."
- [request]
+ [request])
(defroutes rest-routes
(GET "/rest/get-local-data" request (route/restricted (get-local-data request)))
From 0eac2f558122e286ff04daac4f86a535fb309843 Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Sat, 12 May 2018 14:26:22 +0100
Subject: [PATCH 06/51] Added migration for reference data, canonical ADL.
---
.../20180408124500-reference-data.down.sql | 1 +
.../20180408124500-reference-data.up.sql | 2 +
youyesyet.canonical.adl.xml | 356 ++++++++++++++++++
3 files changed, 359 insertions(+)
create mode 100644 resources/migrations/20180408124500-reference-data.down.sql
create mode 100644 resources/migrations/20180408124500-reference-data.up.sql
create mode 100644 youyesyet.canonical.adl.xml
diff --git a/resources/migrations/20180408124500-reference-data.down.sql b/resources/migrations/20180408124500-reference-data.down.sql
new file mode 100644
index 0000000..68bada9
--- /dev/null
+++ b/resources/migrations/20180408124500-reference-data.down.sql
@@ -0,0 +1 @@
+alter table issues drop column current;
diff --git a/resources/migrations/20180408124500-reference-data.up.sql b/resources/migrations/20180408124500-reference-data.up.sql
new file mode 100644
index 0000000..aaae234
--- /dev/null
+++ b/resources/migrations/20180408124500-reference-data.up.sql
@@ -0,0 +1,2 @@
+alter table issues add column current boolean default true;
+
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
new file mode 100644
index 0000000..7d8ca0e
--- /dev/null
+++ b/youyesyet.canonical.adl.xml
@@ -0,0 +1,356 @@
+
+
+
+
+
+
+
+
+ See
+ https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/488478/Bulk_Data_Transfer_-_additional_validation_valid_from_12_November_2015.pdf,
+ section 3
+ A valid postcode.
+
+
+ All users
+
+
+ All users of the canvasser app Able to read and add canvassing data in a limited
+ radius around their current position.
+
+
+ Organisers of canvassing teams Able to see and modify data on the canvassers in
+ the team(s) they organise; able to add canvassers to their team; able to update canvassers in
+ their team, including resetting passwords and locking accounts; able to see canvass data over
+ the whole area in which their team operates.
+
+
+ People expert on particular issues. Able to read followup requests, and the electors to which they
+ relate; able to access (read/write) the issues wiki; able to write followuop action records.
+
+
+
+ Users entitled to see an overview of the canvassing data collected. Able to read canvassing data over the whole map, including historical
+ data.
+
+
+ Users responsible for determining what issues should be current at any time.
+ Able to set current issues; able to add issues.
+
+
+ Able to read and update canvasser records, team membership records, team
+ organisership records, issue expertise records; able to add and update reference data
+ generally.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Issues believed to be of interest to electors, about which they may have questions.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Link table.
+
+
+
+
+
+
+
+
+
+
+
+ Primary users of the system: those actually interviewing electors.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ But only their own record
+
+
+ But only canvassers in their own team.
+
+
+ All canvassers
+
+
+
+ Requests for a followup with an issue expert
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+ A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.
+
+
+
+
+
+
+
+
+
+
+ Teams of canvassers who work together under common leadership.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ But only their own group(s)
+
+
+ All groups
+
+
+
+ Electoral districts
+
+
+
+
+
+
+
+
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+ Actions taken on followup requests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ But only for electors in their immediate vicinity
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+
+
+
+ Options in the election or referendum being canvassed on
+
+
+
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 162274c23fd410d1e35f485ec3af2cc7caa4c4e4 Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Sun, 13 May 2018 18:36:17 +0100
Subject: [PATCH 07/51] Getting serious autogenerated files now!
---
resources/sql/queries.auto.sql | 1008 +++++++++++---------------------
youyesyet.canonical.adl.xml | 6 +-
2 files changed, 340 insertions(+), 674 deletions(-)
diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql
index b8f5451..5f63d1e 100644
--- a/resources/sql/queries.auto.sql
+++ b/resources/sql/queries.auto.sql
@@ -1,104 +1,104 @@
--- :name delete-elector! :! :n
--- :doc updates an existing elector record
-DELETE FROM electors
-WHERE electors.id = :id
+-- File queries.sql
+-- autogenerated by adl.to-hugsql-queries at
+-- 2018-05-13T16:47:04.188Z
+-- See [Application Description Language](https://github.com/simon-brooke/adl).
--- :name get-district :? :1
--- :doc selects an existing district record
-SELECT * FROM districts
-WHERE districts.id = :id
-ORDER BY districts.id
--- :name update-addresse! :! :n
--- :doc updates an existing addresse record
-UPDATE addresses
-SET id = :id,
- address = :address,
- postcode = :postcode,
- phone = :phone,
- district_id = :district_id,
- latitude = :latitude,
- longitude = :longitude
-WHERE addresses.id = :id
--- :name list-teamorganiserships-teams-by-canvasser :? :*
--- :doc lists all existing teams records related through teamorganiserships to a given canvasser
-SELECT teams.*
-FROM teams, teamorganiserships
-WHERE teams. = teamorganiserships.team_id
- AND teamorganiserships.canvasser_id = :id
-ORDER BY teams.
+-- :name create-address! :! :n
+-- :doc creates a new address record
+INSERT INTO addresses (address,
+ postcode,
+ phone,
+ district_id,
+ latitude,
+ longitude)
+VALUES (:address,
+ :postcode,
+ :phone,
+ :district_id,
+ :latitude,
+ :longitude)
-- :name create-authority! :! :n
-- :doc creates a new authority record
INSERT INTO authorities (id)
VALUES (:id)
-returning id
--- :name list-canvassers :? :*
--- :doc lists all existing canvasser records
-SELECT * FROM canvassers
-ORDER BY canvassers.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name create-canvasser! :! :n
+-- :doc creates a new canvasser record
+INSERT INTO canvassers (username,
+ fullname,
+ elector_id,
+ address_id,
+ phone,
+ email,
+ authority_id,
+ authorised)
+VALUES (:username,
+ :fullname,
+ :elector_id,
+ :address_id,
+ :phone,
+ :email,
+ :authority_id,
+ :authorised)
--- :name delete-canvasser! :! :n
--- :doc updates an existing canvasser record
-DELETE FROM canvassers
-WHERE canvassers.id = :id
+-- :name create-district! :! :n
+-- :doc creates a new district record
+INSERT INTO districts (name)
+VALUES (:name)
--- :name get-followupmethod :? :1
--- :doc selects an existing followupmethod record
-SELECT * FROM followupmethods
-WHERE followupmethods.id = :id
-ORDER BY followupmethods.id
+-- :name create-elector! :! :n
+-- :doc creates a new elector record
+INSERT INTO electors (name,
+ address_id,
+ phone,
+ email,
+ gender)
+VALUES (:name,
+ :address_id,
+ :phone,
+ :email,
+ :gender)
--- :name get-canvasser :? :1
--- :doc selects an existing canvasser record
-SELECT * FROM canvassers
-WHERE canvassers.id = :id
-ORDER BY canvassers.id
+-- :name create-followupaction! :! :n
+-- :doc creates a new followupaction record
+INSERT INTO followupactions (request_id,
+ actor,
+ date,
+ notes,
+ closed,
+ id)
+VALUES (:request_id,
+ :actor,
+ :date,
+ :notes,
+ :closed,
+ :id)
--- :name create-role! :! :n
--- :doc creates a new role record
-INSERT INTO roles (id,
- name)
-VALUES (:id,
- :name)
+-- :name create-followupmethod! :! :n
+-- :doc creates a new followupmethod record
+INSERT INTO followupmethods (id)
+VALUES (:id)
--- :name list-issueexpertise-issues-by-canvasser :? :*
--- :doc lists all existing issues records related through issueexpertise to a given canvasser
-SELECT issues.*
-FROM issues, issueexpertise
-WHERE issues.id = issueexpertise.issue_id
- AND issueexpertise.canvasser_id = :id
-ORDER BY issues.id
+-- :name create-followuprequest! :! :n
+-- :doc creates a new followuprequest record
+INSERT INTO followuprequests (elector_id,
+ visit_id,
+ issue_id,
+ method_id,
+ id)
+VALUES (:elector_id,
+ :visit_id,
+ :issue_id,
+ :method_id,
+ :id)
--- :name update-followupaction! :! :n
--- :doc updates an existing followupaction record
-UPDATE followupactions
-SET id = :id,
- request_id = :request_id,
- actor = :actor,
- date = :date,
- notes = :notes,
- closed = :closed
-WHERE followupactions.id = :id
-
--- :name list-teammemberships-teams-by-canvasser :? :*
--- :doc lists all existing teams records related through teammemberships to a given canvasser
-SELECT teams.*
-FROM teams, teammemberships
-WHERE teams. = teammemberships.team_id
- AND teammemberships.canvasser_id = :id
-ORDER BY teams.
-
--- :name list-authorities :? :*
--- :doc lists all existing authority records
-SELECT * FROM authorities
-ORDER BY authorities.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name create-gender! :! :n
+-- :doc creates a new gender record
+INSERT INTO genders (id)
+VALUES (:id)
-- :name create-intention! :! :n
-- :doc creates a new intention record
@@ -109,313 +109,33 @@ VALUES (:visit_id,
:elector_id,
:option_id)
--- :name delete-issue! :! :n
--- :doc updates an existing issue record
-DELETE FROM issues
-WHERE issues.id = :id
-
--- :name list-followuprequests-by-visit :? :*
--- :doc lists all existing followuprequest records related to a given visit
-SELECT *
-FROM followuprequests
-WHERE followuprequests.visit_id = :id
-ORDER BY followuprequests.id
-
--- :name list-canvassers-by-addresse :? :*
--- :doc lists all existing canvasser records related to a given addresse
-SELECT *
-FROM canvassers
-WHERE canvassers.address_id = :id
-ORDER BY canvassers.id
-
--- :name list-intentions-options-by-elector :? :*
--- :doc lists all existing options records related through intentions to a given elector
-SELECT options.*
-FROM options, intentions
-WHERE options.id = intentions.option_id
- AND intentions.elector_id = :id
-ORDER BY options.id
-
--- :name create-followupmethod! :! :n
--- :doc creates a new followupmethod record
-INSERT INTO followupmethods (id)
-VALUES (:id)
-returning id
-
--- :name list-canvassers-by-elector :? :*
--- :doc lists all existing canvasser records related to a given elector
-SELECT *
-FROM canvassers
-WHERE canvassers.elector_id = :id
-ORDER BY canvassers.id
-
--- :name create-district! :! :n
--- :doc creates a new district record
-INSERT INTO districts (id,
- name)
-VALUES (:id,
- :name)
-returning id
-
--- :name delete-followupaction! :! :n
--- :doc updates an existing followupaction record
-DELETE FROM followupactions
-WHERE followupactions.id = :id
-
--- :name create-followupaction! :! :n
--- :doc creates a new followupaction record
-INSERT INTO followupactions (id,
- request_id,
- actor,
- date,
- notes,
- closed)
-VALUES (:id,
- :request_id,
- :actor,
- :date,
- :notes,
- :closed)
-returning id
-
--- :name list-canvassers-by-authoritie :? :*
--- :doc lists all existing canvasser records related to a given authoritie
-SELECT *
-FROM canvassers
-WHERE canvassers.authority_id = :id
-ORDER BY canvassers.id
-
--- :name list-followuprequests :? :*
--- :doc lists all existing followuprequest records
-SELECT * FROM followuprequests
-ORDER BY followuprequests.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name list-followupactions :? :*
--- :doc lists all existing followupaction records
-SELECT * FROM followupactions
-ORDER BY followupactions.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name create-followuprequest! :! :n
--- :doc creates a new followuprequest record
-INSERT INTO followuprequests (id,
- elector_id,
- visit_id,
- issue_id,
- method_id)
-VALUES (:id,
- :elector_id,
- :visit_id,
- :issue_id,
- :method_id)
-returning id
-
--- :name update-issue! :! :n
--- :doc updates an existing issue record
-UPDATE issues
-SET id = :id,
- url = :url
-WHERE issues.id = :id
-
--- :name get-option :? :1
--- :doc selects an existing option record
-SELECT * FROM options
-WHERE options.id = :id
-ORDER BY options.id
-
--- :name list-issueexpertise-followupmethods-by-issue :? :*
--- :doc lists all existing followupmethods records related through issueexpertise to a given issue
-SELECT followupmethods.*
-FROM followupmethods, issueexpertise
-WHERE followupmethods.id = issueexpertise.method_id
- AND issueexpertise.issue_id = :id
-ORDER BY followupmethods.id
-
--- :name list-intentions-visits-by-option :? :*
--- :doc lists all existing visits records related through intentions to a given option
-SELECT visits.*
-FROM visits, intentions
-WHERE visits.id = intentions.visit_id
- AND intentions.option_id = :id
-ORDER BY visits.id
-
--- :name list-teams :? :*
--- :doc lists all existing team records
-SELECT * FROM teams
-ORDER BY teams.
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name list-schema_migrations :? :*
--- :doc lists all existing schema-migration records
-SELECT * FROM schema_migrations
-ORDER BY schema_migrations.
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name create-elector! :! :n
--- :doc creates a new elector record
-INSERT INTO electors (id,
- name,
- address_id,
- phone,
- email)
-VALUES (:id,
- :name,
- :address_id,
- :phone,
- :email)
-returning id
-
--- :name delete-addresse! :! :n
--- :doc updates an existing addresse record
-DELETE FROM addresses
-WHERE addresses.id = :id
-
--- :name delete-followuprequest! :! :n
--- :doc updates an existing followuprequest record
-DELETE FROM followuprequests
-WHERE followuprequests.id = :id
-
--- :name list-options :? :*
--- :doc lists all existing option records
-SELECT * FROM options
-ORDER BY options.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name get-followupaction :? :1
--- :doc selects an existing followupaction record
-SELECT * FROM followupactions
-WHERE followupactions.id = :id
-ORDER BY followupactions.id
-
--- :name list-followupactions-by-canvasser :? :*
--- :doc lists all existing followupaction records related to a given canvasser
-SELECT *
-FROM followupactions
-WHERE followupactions.actor = :id
-ORDER BY followupactions.id
-
--- :name get-issue :? :1
--- :doc selects an existing issue record
-SELECT * FROM issues
-WHERE issues.id = :id
-ORDER BY issues.id
-
--- :name create-teamorganisership! :! :n
--- :doc creates a new teamorganisership record
-INSERT INTO teamorganiserships (team_id,
- canvasser_id)
-VALUES (:team_id,
- :canvasser_id)
-
--- :name get-visit :? :1
--- :doc selects an existing visit record
-SELECT * FROM visits
-WHERE visits.id = :id
-ORDER BY visits.id
-
--- :name list-addresses :? :*
--- :doc lists all existing addresse records
-SELECT * FROM addresses
-ORDER BY addresses.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name create-team! :! :n
--- :doc creates a new team record
-INSERT INTO teams (id,
- name,
- district_id,
- latitude,
- longitude)
-VALUES (:id,
- :name,
- :district_id,
- :latitude,
- :longitude)
-
--- :name list-addresses-by-district :? :*
--- :doc lists all existing addresse records related to a given district
-SELECT *
-FROM addresses
-WHERE addresses.district_id = :id
-ORDER BY addresses.id
-
-- :name create-issue! :! :n
-- :doc creates a new issue record
-INSERT INTO issues (id,
- url)
-VALUES (:id,
- :url)
-returning id
+INSERT INTO issues (url,
+ current,
+ id)
+VALUES (:url,
+ :current,
+ :id)
--- :name delete-authority! :! :n
--- :doc updates an existing authority record
-DELETE FROM authorities
-WHERE authorities.id = :id
+-- :name create-issueexpertis! :! :n
+-- :doc creates a new issueexpertis record
+INSERT INTO issueexpertise (canvasser_id,
+ issue_id,
+ method_id)
+VALUES (:canvasser_id,
+ :issue_id,
+ :method_id)
--- :name create-canvasser! :! :n
--- :doc creates a new canvasser record
-INSERT INTO canvassers (id,
- username,
- fullname,
- elector_id,
- address_id,
- phone,
- email,
- authority_id,
- authorised)
-VALUES (:id,
- :username,
- :fullname,
- :elector_id,
- :address_id,
- :phone,
- :email,
- :authority_id,
- :authorised)
-returning id
+-- :name create-option! :! :n
+-- :doc creates a new option record
+INSERT INTO options (id)
+VALUES (:id)
--- :name list-visits-by-addresse :? :*
--- :doc lists all existing visit records related to a given addresse
-SELECT *
-FROM visits
-WHERE visits.address_id = :id
-ORDER BY visits.id
-
--- :name delete-district! :! :n
--- :doc updates an existing district record
-DELETE FROM districts
-WHERE districts.id = :id
-
--- :name get-addresse :? :1
--- :doc selects an existing addresse record
-SELECT * FROM addresses
-WHERE addresses.id = :id
-ORDER BY addresses.id
-
--- :name create-addresse! :! :n
--- :doc creates a new addresse record
-INSERT INTO addresses (id,
- address,
- postcode,
- phone,
- district_id,
- latitude,
- longitude)
-VALUES (:id,
- :address,
- :postcode,
- :phone,
- :district_id,
- :latitude,
- :longitude)
-returning id
+-- :name create-role! :! :n
+-- :doc creates a new role record
+INSERT INTO roles (name)
+VALUES (:name)
-- :name create-rolemembership! :! :n
-- :doc creates a new rolemembership record
@@ -424,19 +144,16 @@ INSERT INTO rolememberships (role_id,
VALUES (:role_id,
:canvasser_id)
--- :name list-issueexpertise-followupmethods-by-canvasser :? :*
--- :doc lists all existing followupmethods records related through issueexpertise to a given canvasser
-SELECT followupmethods.*
-FROM followupmethods, issueexpertise
-WHERE followupmethods.id = issueexpertise.method_id
- AND issueexpertise.canvasser_id = :id
-ORDER BY followupmethods.id
-
--- :name get-followuprequest :? :1
--- :doc selects an existing followuprequest record
-SELECT * FROM followuprequests
-WHERE followuprequests.id = :id
-ORDER BY followuprequests.id
+-- :name create-team! :! :n
+-- :doc creates a new team record
+INSERT INTO teams (name,
+ district_id,
+ latitude,
+ longitude)
+VALUES (:name,
+ :district_id,
+ :latitude,
+ :longitude)
-- :name create-teammembership! :! :n
-- :doc creates a new teammembership record
@@ -445,291 +162,240 @@ INSERT INTO teammemberships (team_id,
VALUES (:team_id,
:canvasser_id)
--- :name delete-option! :! :n
--- :doc updates an existing option record
-DELETE FROM options
-WHERE options.id = :id
+-- :name create-teamorganisership! :! :n
+-- :doc creates a new teamorganisership record
+INSERT INTO teamorganiserships (team_id,
+ canvasser_id)
+VALUES (:team_id,
+ :canvasser_id)
--- :name list-teammemberships-canvassers-by-team :? :*
--- :doc lists all existing canvassers records related through teammemberships to a given team
-SELECT canvassers.*
-FROM canvassers, teammemberships
-WHERE canvassers.id = teammemberships.canvasser_id
- AND teammemberships.team_id = :id
-ORDER BY canvassers.id
+-- :name create-visit! :! :n
+-- :doc creates a new visit record
+INSERT INTO visits (address_id,
+ canvasser_id,
+ date)
+VALUES (:address_id,
+ :canvasser_id,
+ :date)
--- :name list-issueexpertise-canvassers-by-issue :? :*
--- :doc lists all existing canvassers records related through issueexpertise to a given issue
-SELECT canvassers.*
-FROM canvassers, issueexpertise
-WHERE canvassers.id = issueexpertise.canvasser_id
- AND issueexpertise.issue_id = :id
-ORDER BY canvassers.id
+-- :name list-addresses :? :*
+-- :doc lists all existing address records
+SELECT * FROM addresses
+ORDER BY addresses.address,
+ addresses.postcode
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
--- :name delete-followupmethod! :! :n
--- :doc updates an existing followupmethod record
-DELETE FROM followupmethods
-WHERE followupmethods.id = :id
+-- :name list-addresses-by-district :? :*
+-- :doc lists all existing address records related to a given district
+SELECT *
+FROM addresses
+WHERE addresses.district_id = :id
+ORDER BY addresses.address,
+ addresses.postcode
+
+-- :name list-canvassers :? :*
+-- :doc lists all existing canvasser records
+SELECT * FROM canvassers
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-canvassers-by-address :? :*
+-- :doc lists all existing canvasser records related to a given address
+SELECT *
+FROM canvassers
+WHERE canvassers.address_id = :id
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email
+
+-- :name list-canvassers-by-authority :? :*
+-- :doc lists all existing canvasser records related to a given authority
+SELECT *
+FROM canvassers
+WHERE canvassers.authority_id = :id
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email
+
+-- :name list-canvassers-by-elector :? :*
+-- :doc lists all existing canvasser records related to a given elector
+SELECT *
+FROM canvassers
+WHERE canvassers.elector_id = :id
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email
-- :name list-districts :? :*
-- :doc lists all existing district records
SELECT * FROM districts
-ORDER BY districts.id
+ORDER BY districts.name
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
--- :name list-rolememberships-canvassers-by-role :? :*
--- :doc lists all existing canvassers records related through rolememberships to a given role
-SELECT canvassers.*
-FROM canvassers, rolememberships
-WHERE canvassers.id = rolememberships.canvasser_id
- AND rolememberships.role_id = :id
-ORDER BY canvassers.id
-
--- :name get-authority :? :1
--- :doc selects an existing authority record
-SELECT * FROM authorities
-WHERE authorities.id = :id
-ORDER BY authorities.id
-
--- :name create-option! :! :n
--- :doc creates a new option record
-INSERT INTO options (id)
-VALUES (:id)
-returning id
-
--- :name list-visits :? :*
--- :doc lists all existing visit records
-SELECT * FROM visits
-ORDER BY visits.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name list-teamorganiserships-canvassers-by-team :? :*
--- :doc lists all existing canvassers records related through teamorganiserships to a given team
-SELECT canvassers.*
-FROM canvassers, teamorganiserships
-WHERE canvassers.id = teamorganiserships.canvasser_id
- AND teamorganiserships.team_id = :id
-ORDER BY canvassers.id
-
--- :name get-elector :? :1
--- :doc selects an existing elector record
-SELECT * FROM electors
-WHERE electors.id = :id
-ORDER BY electors.id
-
--- :name create-visit! :! :n
--- :doc creates a new visit record
-INSERT INTO visits (id,
- address_id,
- canvasser_id,
- date)
-VALUES (:id,
- :address_id,
- :canvasser_id,
- :date)
-returning id
-
--- :name list-roles :? :*
--- :doc lists all existing role records
-SELECT * FROM roles
-ORDER BY roles.
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name update-visit! :! :n
--- :doc updates an existing visit record
-UPDATE visits
-SET id = :id,
- address_id = :address_id,
- canvasser_id = :canvasser_id,
- date = :date
-WHERE visits.id = :id
-
--- :name update-district! :! :n
--- :doc updates an existing district record
-UPDATE districts
-SET id = :id,
- name = :name
-WHERE districts.id = :id
-
--- :name list-followupactions-by-followuprequest :? :*
--- :doc lists all existing followupaction records related to a given followuprequest
-SELECT *
-FROM followupactions
-WHERE followupactions.request_id = :id
-ORDER BY followupactions.id
-
--- :name create-issueexpertise! :! :n
--- :doc creates a new issueexpertise record
-INSERT INTO issueexpertise (canvasser_id,
- issue_id,
- method_id)
-VALUES (:canvasser_id,
- :issue_id,
- :method_id)
-
--- :name list-issueexpertise-canvassers-by-followupmethod :? :*
--- :doc lists all existing canvassers records related through issueexpertise to a given followupmethod
-SELECT canvassers.*
-FROM canvassers, issueexpertise
-WHERE canvassers.id = issueexpertise.canvasser_id
- AND issueexpertise.method_id = :id
-ORDER BY canvassers.id
-
--- :name update-elector! :! :n
--- :doc updates an existing elector record
-UPDATE electors
-SET id = :id,
- name = :name,
- address_id = :address_id,
- phone = :phone,
- email = :email
-WHERE electors.id = :id
-
--- :name list-followupmethods :? :*
--- :doc lists all existing followupmethod records
-SELECT * FROM followupmethods
-ORDER BY followupmethods.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name delete-visit! :! :n
--- :doc updates an existing visit record
-DELETE FROM visits
-WHERE visits.id = :id
-
--- :name list-intentions-electors-by-option :? :*
--- :doc lists all existing electors records related through intentions to a given option
-SELECT electors.*
-FROM electors, intentions
-WHERE electors.id = intentions.elector_id
- AND intentions.option_id = :id
-ORDER BY electors.id
-
--- :name create-schema-migration! :! :n
--- :doc creates a new schema-migration record
-INSERT INTO schema_migrations (id)
-VALUES (:id)
-
--- :name update-canvasser! :! :n
--- :doc updates an existing canvasser record
-UPDATE canvassers
-SET id = :id,
- username = :username,
- fullname = :fullname,
- elector_id = :elector_id,
- address_id = :address_id,
- phone = :phone,
- email = :email,
- authority_id = :authority_id,
- authorised = :authorised
-WHERE canvassers.id = :id
-
--- :name list-intentions-options-by-visit :? :*
--- :doc lists all existing options records related through intentions to a given visit
-SELECT options.*
-FROM options, intentions
-WHERE options.id = intentions.option_id
- AND intentions.visit_id = :id
-ORDER BY options.id
-
--- :name list-followuprequests-by-issue :? :*
--- :doc lists all existing followuprequest records related to a given issue
-SELECT *
-FROM followuprequests
-WHERE followuprequests.issue_id = :id
-ORDER BY followuprequests.id
-
--- :name list-followuprequests-by-followupmethod :? :*
--- :doc lists all existing followuprequest records related to a given followupmethod
-SELECT *
-FROM followuprequests
-WHERE followuprequests.method_id = :id
-ORDER BY followuprequests.id
-
--- :name list-intentions-visits-by-elector :? :*
--- :doc lists all existing visits records related through intentions to a given elector
-SELECT visits.*
-FROM visits, intentions
-WHERE visits.id = intentions.visit_id
- AND intentions.elector_id = :id
-ORDER BY visits.id
-
--- :name list-rolememberships-roles-by-canvasser :? :*
--- :doc lists all existing roles records related through rolememberships to a given canvasser
-SELECT roles.*
-FROM roles, rolememberships
-WHERE roles. = rolememberships.role_id
- AND rolememberships.canvasser_id = :id
-ORDER BY roles.
-
--- :name list-intentions-electors-by-visit :? :*
--- :doc lists all existing electors records related through intentions to a given visit
-SELECT electors.*
-FROM electors, intentions
-WHERE electors.id = intentions.elector_id
- AND intentions.visit_id = :id
-ORDER BY electors.id
-
--- :name list-issueexpertise-issues-by-followupmethod :? :*
--- :doc lists all existing issues records related through issueexpertise to a given followupmethod
-SELECT issues.*
-FROM issues, issueexpertise
-WHERE issues.id = issueexpertise.issue_id
- AND issueexpertise.method_id = :id
-ORDER BY issues.id
-
--- :name list-teams-by-district :? :*
--- :doc lists all existing team records related to a given district
-SELECT *
-FROM teams
-WHERE teams.district_id = :id
-ORDER BY teams.
-
--- :name list-issues :? :*
--- :doc lists all existing issue records
-SELECT * FROM issues
-ORDER BY issues.id
---~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-
--- :name list-electors-by-addresse :? :*
--- :doc lists all existing elector records related to a given addresse
-SELECT *
-FROM electors
-WHERE electors.address_id = :id
-ORDER BY electors.id
-
--- :name list-visits-by-canvasser :? :*
--- :doc lists all existing visit records related to a given canvasser
-SELECT *
-FROM visits
-WHERE visits.canvasser_id = :id
-ORDER BY visits.id
-
-- :name list-electors :? :*
-- :doc lists all existing elector records
SELECT * FROM electors
-ORDER BY electors.id
+ORDER BY electors.name,
+ electors.phone,
+ electors.email
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
--- :name list-followuprequests-by-elector :? :*
--- :doc lists all existing followuprequest records related to a given elector
-SELECT *
-FROM followuprequests
-WHERE followuprequests.elector_id = :id
-ORDER BY followuprequests.id
+-- :name list-electors-by-address :? :*
+-- :doc lists all existing elector records related to a given address
+SELECT *
+FROM electors
+WHERE electors.address_id = :id
+ORDER BY electors.name,
+ electors.phone,
+ electors.email
--- :name update-followuprequest! :! :n
--- :doc updates an existing followuprequest record
-UPDATE followuprequests
-SET id = :id,
- elector_id = :elector_id,
- visit_id = :visit_id,
- issue_id = :issue_id,
- method_id = :method_id
-WHERE followuprequests.id = :id
+-- :name list-electors-by-gender :? :*
+-- :doc lists all existing elector records related to a given gender
+SELECT *
+FROM electors
+WHERE electors.gender = :id
+ORDER BY electors.name,
+ electors.phone,
+ electors.email
+-- :name list-followupactions :? :*
+-- :doc lists all existing followupaction records
+SELECT * FROM followupactions
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-followupactions-by-canvasser :? :*
+-- :doc lists all existing followupaction records related to a given canvasser
+SELECT *
+FROM followupactions
+WHERE followupactions.actor = :id
+
+-- :name list-followupactions-by-followuprequest :? :*
+-- :doc lists all existing followupaction records related to a given followuprequest
+SELECT *
+FROM followupactions
+WHERE followupactions.request_id = :id
+
+-- :name list-issues :? :*
+-- :doc lists all existing issue records
+SELECT * FROM issues
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-roles :? :*
+-- :doc lists all existing role records
+SELECT * FROM roles
+ORDER BY roles.name
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-teams :? :*
+-- :doc lists all existing team records
+SELECT * FROM teams
+ORDER BY teams.name
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-teams-by-district :? :*
+-- :doc lists all existing team records related to a given district
+SELECT *
+FROM teams
+WHERE teams.district_id = :id
+ORDER BY teams.name
+
+-- :name list-visits :? :*
+-- :doc lists all existing visit records
+SELECT * FROM visits
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-visits-by-address :? :*
+-- :doc lists all existing visit records related to a given address
+SELECT *
+FROM visits
+WHERE visits.address_id = :id
+
+-- :name list-visits-by-canvasser :? :*
+-- :doc lists all existing visit records related to a given canvasser
+SELECT *
+FROM visits
+WHERE visits.canvasser_id = :id
+
+-- :name search-strings-address :? :1
+-- :doc selects existing address records having any string field matching `:pattern` by substring match
+SELECT * FROM addresses
+WHERE
+address LIKE '%:pattern%'
+ OR phone LIKE '%:pattern%'
+ORDER BY addresses.address,
+ addresses.postcode
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-canvasser :? :1
+-- :doc selects existing canvasser records having any string field matching `:pattern` by substring match
+SELECT * FROM canvassers
+WHERE
+username LIKE '%:pattern%'
+ OR fullname LIKE '%:pattern%'
+ OR phone LIKE '%:pattern%'
+ OR email LIKE '%:pattern%'
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-district :? :1
+-- :doc selects existing district records having any string field matching `:pattern` by substring match
+SELECT * FROM districts
+WHERE
+name LIKE '%:pattern%'
+ORDER BY districts.name
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-elector :? :1
+-- :doc selects existing elector records having any string field matching `:pattern` by substring match
+SELECT * FROM electors
+WHERE
+name LIKE '%:pattern%'
+ OR phone LIKE '%:pattern%'
+ OR email LIKE '%:pattern%'
+ORDER BY electors.name,
+ electors.phone,
+ electors.email
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-issue :? :1
+-- :doc selects existing issue records having any string field matching `:pattern` by substring match
+SELECT * FROM issues
+WHERE
+url LIKE '%:pattern%'
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-role :? :1
+-- :doc selects existing role records having any string field matching `:pattern` by substring match
+SELECT * FROM roles
+WHERE
+name LIKE '%:pattern%'
+ORDER BY roles.name
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-team :? :1
+-- :doc selects existing team records having any string field matching `:pattern` by substring match
+SELECT * FROM teams
+WHERE
+name LIKE '%:pattern%'
+ORDER BY teams.name
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
\ No newline at end of file
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
index 7d8ca0e..0fa1f0a 100644
--- a/youyesyet.canonical.adl.xml
+++ b/youyesyet.canonical.adl.xml
@@ -45,7 +45,7 @@
-
+
@@ -82,13 +82,13 @@
-
+
-
+
From f86c5cffe6b8b10a31d595d668b6b31858c41a66 Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Sat, 26 May 2018 19:23:21 +0100
Subject: [PATCH 08/51] Mainly, added the dwellings table, implied by the
revised ERD.
Some other tidy up.
---
.../entity-relationship-diagram.svg | 313 +++++-----
project.clj | 1 +
.../20180526162051-dwellings.down.sql | 8 +
.../20180526162051-dwellings.up.sql | 11 +
resources/sql/queries.auto.sql | 539 ++++++++++++++++--
src/clj/youyesyet/routes/auto_json_routes.clj | 28 +-
youyesyet.adl.xml | 392 +++++++++++++
youyesyet.canonical.adl.xml | 240 ++++++--
8 files changed, 1258 insertions(+), 274 deletions(-)
create mode 100644 resources/migrations/20180526162051-dwellings.down.sql
create mode 100644 resources/migrations/20180526162051-dwellings.up.sql
create mode 100644 youyesyet.adl.xml
diff --git a/doc/specification/entity-relationship-diagram.svg b/doc/specification/entity-relationship-diagram.svg
index dbb5475..2e51c1e 100644
--- a/doc/specification/entity-relationship-diagram.svg
+++ b/doc/specification/entity-relationship-diagram.svg
@@ -14,7 +14,7 @@
viewBox="0 0 1052.3622 744.09448"
id="svg2"
version="1.1"
- inkscape:version="0.91 r13725"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="entity-relationship-diagram.svg">
@@ -32,7 +32,7 @@
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1920"
- inkscape:window-height="1058"
+ inkscape:window-height="1043"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1">
@@ -66,27 +66,26 @@
y="312.36218" />
+ y="335.1539"
+ style="font-size:20px;line-height:1.25">Â YouYesYet: Entity Relationship Diagram
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:20px;line-height:1.25;font-family:Arial;-inkscape-font-specification:'Arial Bold'">YouYesYet: Entity Relationship DiagramDistrict
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial">District
Addresss
+ sodipodi:role="line">Address
Elector
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial">Elector
 Authority
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial">AuthorityVisit
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial">Visit
IssueIssueExpertiseFollowupFollowupFollowupAction
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:15px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial">Action
@@ -528,13 +517,12 @@
id="rect4323"
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.4000001;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
Version: 0.2Date: 20170315Author: Simon BrookeCopyright: (c) 2016 Simon Brooke for Radical Independence CampaignIntroducedVisitedRecorded
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">RecordedRaised
+ style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Bold Italic';text-align:start;writing-mode:lr-tb;text-anchor:start">RaisedAuthenticates
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">AuthenticatesHas
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Has
About
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">About
AboutResponded to
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Responded to
Expressed
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Expressed
Contains
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Contains
Resides at
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Resides at
Requested
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Requested
Performed
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">Performed
To
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10px;line-height:125%;font-family:Arial;-inkscape-font-specification:'Arial, Normal';text-align:start;writing-mode:lr-tb;text-anchor:start">To
+ y="562.36218"
+ style="font-size:20px;line-height:1.25">Â Organiser-Organiser-shipTeamTeamMembership
+ id="tspan4385"
+ style="font-size:15px;line-height:1.25">Membership
HasHasof
+ style="font-size:10px;line-height:1.25">of
of
+ style="font-size:10px;line-height:1.25">of
@@ -1035,16 +1002,15 @@
For
+ style="font-size:10px;line-height:1.25">For
RoleRoleMembership
+ id="tspan4383"
+ style="font-size:15px;line-height:1.25">Membership
@@ -1078,16 +1045,16 @@
x="561.61688"
y="774.30139" />
Role
+ sodipodi:role="line"
+ style="font-size:15px;line-height:1.25">Role
@@ -1114,28 +1081,26 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
Is
+ style="font-size:10px;line-height:1.25">Is
Includes
+ style="font-size:10px;line-height:1.25">Includes
diff --git a/project.clj b/project.clj
index 6108563..cd9bd48 100644
--- a/project.clj
+++ b/project.clj
@@ -53,6 +53,7 @@
[migratus-lein "0.4.2"]
[org.clojars.punkisdead/lein-cucumber "1.0.5"]
[lein-cljsbuild "1.1.4"]
+ [lein-codox "0.10.3"]
[lein-uberwar "0.2.0"]
[lein-bower "0.5.1"]
[lein-less "1.7.5"]]
diff --git a/resources/migrations/20180526162051-dwellings.down.sql b/resources/migrations/20180526162051-dwellings.down.sql
new file mode 100644
index 0000000..ab91769
--- /dev/null
+++ b/resources/migrations/20180526162051-dwellings.down.sql
@@ -0,0 +1,8 @@
+alter table electors
+ add column address_id references addresses on delete no action;
+
+update electors
+ set address_id =
+ (select address_id
+ from dwellings
+ where dwellings.id electors.dwelling_id);
diff --git a/resources/migrations/20180526162051-dwellings.up.sql b/resources/migrations/20180526162051-dwellings.up.sql
new file mode 100644
index 0000000..41e1a6e
--- /dev/null
+++ b/resources/migrations/20180526162051-dwellings.up.sql
@@ -0,0 +1,11 @@
+CREATE TABLE dwellings
+(
+ id INT NOT NULL PRIMARY KEY,
+ address_id INT NOT NULL references addresses on delete no action,
+ sub_address VARCHAR( 32)
+);
+
+alter table electors
+ add column dwelling_id int references dwellings on delete no action;
+
+alter table electors drop column address_id;
diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql
index 5f63d1e..a80bf0f 100644
--- a/resources/sql/queries.auto.sql
+++ b/resources/sql/queries.auto.sql
@@ -1,6 +1,6 @@
-- File queries.sql
-- autogenerated by adl.to-hugsql-queries at
--- 2018-05-13T16:47:04.188Z
+-- 2018-05-26T15:03:25.295Z
-- See [Application Description Language](https://github.com/simon-brooke/adl).
@@ -19,11 +19,13 @@ VALUES (:address,
:district_id,
:latitude,
:longitude)
+returning id
-- :name create-authority! :! :n
-- :doc creates a new authority record
INSERT INTO authorities (id)
VALUES (:id)
+returning id
-- :name create-canvasser! :! :n
-- :doc creates a new canvasser record
@@ -43,24 +45,35 @@ VALUES (:username,
:email,
:authority_id,
:authorised)
+returning id
-- :name create-district! :! :n
-- :doc creates a new district record
INSERT INTO districts (name)
VALUES (:name)
+returning id
+
+-- :name create-dwelling! :! :n
+-- :doc creates a new dwelling record
+INSERT INTO dwellings (address_id,
+ sub-address)
+VALUES (:address_id,
+ :sub-address)
+returning id
-- :name create-elector! :! :n
-- :doc creates a new elector record
INSERT INTO electors (name,
- address_id,
+ dwelling_id,
phone,
email,
gender)
VALUES (:name,
- :address_id,
+ :dwelling_id,
:phone,
:email,
:gender)
+returning id
-- :name create-followupaction! :! :n
-- :doc creates a new followupaction record
@@ -68,37 +81,37 @@ INSERT INTO followupactions (request_id,
actor,
date,
notes,
- closed,
- id)
+ closed)
VALUES (:request_id,
:actor,
:date,
:notes,
- :closed,
- :id)
+ :closed)
+returning id
-- :name create-followupmethod! :! :n
-- :doc creates a new followupmethod record
INSERT INTO followupmethods (id)
VALUES (:id)
+returning id
-- :name create-followuprequest! :! :n
-- :doc creates a new followuprequest record
INSERT INTO followuprequests (elector_id,
visit_id,
issue_id,
- method_id,
- id)
+ method_id)
VALUES (:elector_id,
:visit_id,
:issue_id,
- :method_id,
- :id)
+ :method_id)
+returning id
-- :name create-gender! :! :n
-- :doc creates a new gender record
INSERT INTO genders (id)
VALUES (:id)
+returning id
-- :name create-intention! :! :n
-- :doc creates a new intention record
@@ -108,6 +121,7 @@ INSERT INTO intentions (visit_id,
VALUES (:visit_id,
:elector_id,
:option_id)
+returning Id
-- :name create-issue! :! :n
-- :doc creates a new issue record
@@ -117,6 +131,7 @@ INSERT INTO issues (url,
VALUES (:url,
:current,
:id)
+returning id
-- :name create-issueexpertis! :! :n
-- :doc creates a new issueexpertis record
@@ -126,16 +141,19 @@ INSERT INTO issueexpertise (canvasser_id,
VALUES (:canvasser_id,
:issue_id,
:method_id)
+returning Id
-- :name create-option! :! :n
-- :doc creates a new option record
INSERT INTO options (id)
VALUES (:id)
+returning id
-- :name create-role! :! :n
-- :doc creates a new role record
INSERT INTO roles (name)
VALUES (:name)
+returning id
-- :name create-rolemembership! :! :n
-- :doc creates a new rolemembership record
@@ -143,6 +161,7 @@ INSERT INTO rolememberships (role_id,
canvasser_id)
VALUES (:role_id,
:canvasser_id)
+returning Id
-- :name create-team! :! :n
-- :doc creates a new team record
@@ -154,6 +173,7 @@ VALUES (:name,
:district_id,
:latitude,
:longitude)
+returning id
-- :name create-teammembership! :! :n
-- :doc creates a new teammembership record
@@ -161,6 +181,7 @@ INSERT INTO teammemberships (team_id,
canvasser_id)
VALUES (:team_id,
:canvasser_id)
+returning Id
-- :name create-teamorganisership! :! :n
-- :doc creates a new teamorganisership record
@@ -168,6 +189,7 @@ INSERT INTO teamorganiserships (team_id,
canvasser_id)
VALUES (:team_id,
:canvasser_id)
+returning Id
-- :name create-visit! :! :n
-- :doc creates a new visit record
@@ -177,92 +199,338 @@ INSERT INTO visits (address_id,
VALUES (:address_id,
:canvasser_id,
:date)
+returning id
+
+-- :name delete-address! :! :n
+-- :doc updates an existing address record
+DELETE FROM addresses
+WHERE addresses.id = :id
+
+-- :name delete-authority! :! :n
+-- :doc updates an existing authority record
+DELETE FROM authorities
+WHERE authorities.id = :id
+
+-- :name delete-canvasser! :! :n
+-- :doc updates an existing canvasser record
+DELETE FROM canvassers
+WHERE canvassers.id = :id
+
+-- :name delete-district! :! :n
+-- :doc updates an existing district record
+DELETE FROM districts
+WHERE districts.id = :id
+
+-- :name delete-dwelling! :! :n
+-- :doc updates an existing dwelling record
+DELETE FROM dwellings
+WHERE dwellings.id = :id
+
+-- :name delete-elector! :! :n
+-- :doc updates an existing elector record
+DELETE FROM electors
+WHERE electors.id = :id
+
+-- :name delete-followupaction! :! :n
+-- :doc updates an existing followupaction record
+DELETE FROM followupactions
+WHERE followupactions.id = :id
+
+-- :name delete-followupmethod! :! :n
+-- :doc updates an existing followupmethod record
+DELETE FROM followupmethods
+WHERE followupmethods.id = :id
+
+-- :name delete-followuprequest! :! :n
+-- :doc updates an existing followuprequest record
+DELETE FROM followuprequests
+WHERE followuprequests.id = :id
+
+-- :name delete-gender! :! :n
+-- :doc updates an existing gender record
+DELETE FROM genders
+WHERE genders.id = :id
+
+-- :name delete-intention! :! :n
+-- :doc updates an existing intention record
+DELETE FROM intentions
+WHERE intentions.Id = :Id
+
+-- :name delete-issue! :! :n
+-- :doc updates an existing issue record
+DELETE FROM issues
+WHERE issues.id = :id
+
+-- :name delete-issueexpertis! :! :n
+-- :doc updates an existing issueexpertis record
+DELETE FROM issueexpertise
+WHERE issueexpertise.Id = :Id
+
+-- :name delete-option! :! :n
+-- :doc updates an existing option record
+DELETE FROM options
+WHERE options.id = :id
+
+-- :name delete-role! :! :n
+-- :doc updates an existing role record
+DELETE FROM roles
+WHERE roles.id = :id
+
+-- :name delete-rolemembership! :! :n
+-- :doc updates an existing rolemembership record
+DELETE FROM rolememberships
+WHERE rolememberships.Id = :Id
+
+-- :name delete-team! :! :n
+-- :doc updates an existing team record
+DELETE FROM teams
+WHERE teams.id = :id
+
+-- :name delete-teammembership! :! :n
+-- :doc updates an existing teammembership record
+DELETE FROM teammemberships
+WHERE teammemberships.Id = :Id
+
+-- :name delete-teamorganisership! :! :n
+-- :doc updates an existing teamorganisership record
+DELETE FROM teamorganiserships
+WHERE teamorganiserships.Id = :Id
+
+-- :name delete-visit! :! :n
+-- :doc updates an existing visit record
+DELETE FROM visits
+WHERE visits.id = :id
+
+-- :name get-address :? :1
+-- :doc selects an existing address record
+SELECT * FROM addresses
+WHERE addresses.id = :id
+ORDER BY addresses.address,
+ addresses.postcode,
+ addresses.id
+
+-- :name get-authority :? :1
+-- :doc selects an existing authority record
+SELECT * FROM authorities
+WHERE authorities.id = :id
+
+-- :name get-canvasser :? :1
+-- :doc selects an existing canvasser record
+SELECT * FROM canvassers
+WHERE canvassers.id = :id
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email,
+ canvassers.id
+
+-- :name get-district :? :1
+-- :doc selects an existing district record
+SELECT * FROM districts
+WHERE districts.id = :id
+ORDER BY districts.name,
+ districts.id
+
+-- :name get-dwelling :? :1
+-- :doc selects an existing dwelling record
+SELECT * FROM dwellings
+WHERE dwellings.id = :id
+
+-- :name get-elector :? :1
+-- :doc selects an existing elector record
+SELECT * FROM electors
+WHERE electors.id = :id
+ORDER BY electors.name,
+ electors.phone,
+ electors.email,
+ electors.id
+
+-- :name get-followupaction :? :1
+-- :doc selects an existing followupaction record
+SELECT * FROM followupactions
+WHERE followupactions.id = :id
+
+-- :name get-followupmethod :? :1
+-- :doc selects an existing followupmethod record
+SELECT * FROM followupmethods
+WHERE followupmethods.id = :id
+
+-- :name get-followuprequest :? :1
+-- :doc selects an existing followuprequest record
+SELECT * FROM followuprequests
+WHERE followuprequests.id = :id
+
+-- :name get-gender :? :1
+-- :doc selects an existing gender record
+SELECT * FROM genders
+WHERE genders.id = :id
+
+-- :name get-intention :? :1
+-- :doc selects an existing intention record
+SELECT * FROM intentions
+WHERE intentions.Id = :Id
+
+-- :name get-issue :? :1
+-- :doc selects an existing issue record
+SELECT * FROM issues
+WHERE issues.id = :id
+
+-- :name get-issueexpertis :? :1
+-- :doc selects an existing issueexpertis record
+SELECT * FROM issueexpertise
+WHERE issueexpertise.Id = :Id
+
+-- :name get-option :? :1
+-- :doc selects an existing option record
+SELECT * FROM options
+WHERE options.id = :id
+
+-- :name get-role :? :1
+-- :doc selects an existing role record
+SELECT * FROM roles
+WHERE roles.id = :id
+ORDER BY roles.name,
+ roles.id
+
+-- :name get-rolemembership :? :1
+-- :doc selects an existing rolemembership record
+SELECT * FROM rolememberships
+WHERE rolememberships.Id = :Id
+
+-- :name get-team :? :1
+-- :doc selects an existing team record
+SELECT * FROM teams
+WHERE teams.id = :id
+ORDER BY teams.name,
+ teams.id
+
+-- :name get-teammembership :? :1
+-- :doc selects an existing teammembership record
+SELECT * FROM teammemberships
+WHERE teammemberships.Id = :Id
+
+-- :name get-teamorganisership :? :1
+-- :doc selects an existing teamorganisership record
+SELECT * FROM teamorganiserships
+WHERE teamorganiserships.Id = :Id
+
+-- :name get-visit :? :1
+-- :doc selects an existing visit record
+SELECT * FROM visits
+WHERE visits.id = :id
-- :name list-addresses :? :*
-- :doc lists all existing address records
SELECT * FROM addresses
ORDER BY addresses.address,
- addresses.postcode
+ addresses.postcode,
+ addresses.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name list-addresses-by-district :? :*
-- :doc lists all existing address records related to a given district
-SELECT *
+SELECT *
FROM addresses
WHERE addresses.district_id = :id
ORDER BY addresses.address,
- addresses.postcode
+ addresses.postcode,
+ addresses.id
+
+-- :name list-authorities :? :*
+-- :doc lists all existing authority records
+SELECT * FROM authorities
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name list-canvassers :? :*
-- :doc lists all existing canvasser records
SELECT * FROM canvassers
ORDER BY canvassers.username,
canvassers.fullname,
- canvassers.email
+ canvassers.email,
+ canvassers.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name list-canvassers-by-address :? :*
-- :doc lists all existing canvasser records related to a given address
-SELECT *
+SELECT *
FROM canvassers
WHERE canvassers.address_id = :id
ORDER BY canvassers.username,
canvassers.fullname,
- canvassers.email
+ canvassers.email,
+ canvassers.id
-- :name list-canvassers-by-authority :? :*
-- :doc lists all existing canvasser records related to a given authority
-SELECT *
+SELECT *
FROM canvassers
WHERE canvassers.authority_id = :id
ORDER BY canvassers.username,
canvassers.fullname,
- canvassers.email
+ canvassers.email,
+ canvassers.id
-- :name list-canvassers-by-elector :? :*
-- :doc lists all existing canvasser records related to a given elector
-SELECT *
+SELECT *
FROM canvassers
WHERE canvassers.elector_id = :id
ORDER BY canvassers.username,
canvassers.fullname,
- canvassers.email
+ canvassers.email,
+ canvassers.id
-- :name list-districts :? :*
-- :doc lists all existing district records
SELECT * FROM districts
-ORDER BY districts.name
+ORDER BY districts.name,
+ districts.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name list-dwellings :? :*
+-- :doc lists all existing dwelling records
+SELECT * FROM dwellings
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-dwellings-by-addres :? :*
+-- :doc lists all existing dwelling records related to a given addres
+SELECT *
+FROM dwellings
+WHERE dwellings.address_id = :id
+
-- :name list-electors :? :*
-- :doc lists all existing elector records
SELECT * FROM electors
ORDER BY electors.name,
electors.phone,
- electors.email
+ electors.email,
+ electors.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
--- :name list-electors-by-address :? :*
--- :doc lists all existing elector records related to a given address
-SELECT *
+-- :name list-electors-by-dwelling :? :*
+-- :doc lists all existing elector records related to a given dwelling
+SELECT *
FROM electors
-WHERE electors.address_id = :id
+WHERE electors.dwelling_id = :id
ORDER BY electors.name,
electors.phone,
- electors.email
+ electors.email,
+ electors.id
-- :name list-electors-by-gender :? :*
-- :doc lists all existing elector records related to a given gender
-SELECT *
+SELECT *
FROM electors
WHERE electors.gender = :id
ORDER BY electors.name,
electors.phone,
- electors.email
+ electors.email,
+ electors.id
-- :name list-followupactions :? :*
-- :doc lists all existing followupaction records
@@ -272,42 +540,195 @@ SELECT * FROM followupactions
-- :name list-followupactions-by-canvasser :? :*
-- :doc lists all existing followupaction records related to a given canvasser
-SELECT *
+SELECT *
FROM followupactions
WHERE followupactions.actor = :id
-- :name list-followupactions-by-followuprequest :? :*
-- :doc lists all existing followupaction records related to a given followuprequest
-SELECT *
+SELECT *
FROM followupactions
WHERE followupactions.request_id = :id
+-- :name list-followupmethods :? :*
+-- :doc lists all existing followupmethod records
+SELECT * FROM followupmethods
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-followuprequests :? :*
+-- :doc lists all existing followuprequest records
+SELECT * FROM followuprequests
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-followuprequests-by-elector :? :*
+-- :doc lists all existing followuprequest records related to a given elector
+SELECT *
+FROM followuprequests
+WHERE followuprequests.elector_id = :id
+
+-- :name list-followuprequests-by-followupmethod :? :*
+-- :doc lists all existing followuprequest records related to a given followupmethod
+SELECT *
+FROM followuprequests
+WHERE followuprequests.method_id = :id
+
+-- :name list-followuprequests-by-issue :? :*
+-- :doc lists all existing followuprequest records related to a given issue
+SELECT *
+FROM followuprequests
+WHERE followuprequests.issue_id = :id
+
+-- :name list-followuprequests-by-visit :? :*
+-- :doc lists all existing followuprequest records related to a given visit
+SELECT *
+FROM followuprequests
+WHERE followuprequests.visit_id = :id
+
+-- :name list-genders :? :*
+-- :doc lists all existing gender records
+SELECT * FROM genders
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-intentions :? :*
+-- :doc lists all existing intention records
+SELECT * FROM intentions
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-intentions-by-elector :? :*
+-- :doc lists all existing intention records related to a given elector
+SELECT *
+FROM intentions
+WHERE intentions.elector_id = :id
+
+-- :name list-intentions-by-option :? :*
+-- :doc lists all existing intention records related to a given option
+SELECT *
+FROM intentions
+WHERE intentions.option_id = :id
+
+-- :name list-intentions-by-visit :? :*
+-- :doc lists all existing intention records related to a given visit
+SELECT *
+FROM intentions
+WHERE intentions.visit_id = :id
+
+-- :name list-issueexpertise :? :*
+-- :doc lists all existing issueexpertis records
+SELECT * FROM issueexpertise
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-issueexpertise-by-canvasser :? :*
+-- :doc lists all existing issueexpertis records related to a given canvasser
+SELECT *
+FROM issueexpertise
+WHERE issueexpertise.canvasser_id = :id
+
+-- :name list-issueexpertise-by-followupmethod :? :*
+-- :doc lists all existing issueexpertis records related to a given followupmethod
+SELECT *
+FROM issueexpertise
+WHERE issueexpertise.method_id = :id
+
+-- :name list-issueexpertise-by-issue :? :*
+-- :doc lists all existing issueexpertis records related to a given issue
+SELECT *
+FROM issueexpertise
+WHERE issueexpertise.issue_id = :id
+
-- :name list-issues :? :*
-- :doc lists all existing issue records
SELECT * FROM issues
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name list-options :? :*
+-- :doc lists all existing option records
+SELECT * FROM options
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-rolememberships :? :*
+-- :doc lists all existing rolemembership records
+SELECT * FROM rolememberships
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-rolememberships-by-canvasser :? :*
+-- :doc lists all existing rolemembership records related to a given canvasser
+SELECT *
+FROM rolememberships
+WHERE rolememberships.canvasser_id = :id
+
+-- :name list-rolememberships-by-role :? :*
+-- :doc lists all existing rolemembership records related to a given role
+SELECT *
+FROM rolememberships
+WHERE rolememberships.role_id = :id
+
-- :name list-roles :? :*
-- :doc lists all existing role records
SELECT * FROM roles
-ORDER BY roles.name
+ORDER BY roles.name,
+ roles.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name list-teammemberships :? :*
+-- :doc lists all existing teammembership records
+SELECT * FROM teammemberships
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-teammemberships-by-canvasser :? :*
+-- :doc lists all existing teammembership records related to a given canvasser
+SELECT *
+FROM teammemberships
+WHERE teammemberships.canvasser_id = :id
+
+-- :name list-teammemberships-by-team :? :*
+-- :doc lists all existing teammembership records related to a given team
+SELECT *
+FROM teammemberships
+WHERE teammemberships.team_id = :id
+
+-- :name list-teamorganiserships :? :*
+-- :doc lists all existing teamorganisership records
+SELECT * FROM teamorganiserships
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name list-teamorganiserships-by-canvasser :? :*
+-- :doc lists all existing teamorganisership records related to a given canvasser
+SELECT *
+FROM teamorganiserships
+WHERE teamorganiserships.canvasser_id = :id
+
+-- :name list-teamorganiserships-by-team :? :*
+-- :doc lists all existing teamorganisership records related to a given team
+SELECT *
+FROM teamorganiserships
+WHERE teamorganiserships.team_id = :id
+
-- :name list-teams :? :*
-- :doc lists all existing team records
SELECT * FROM teams
-ORDER BY teams.name
+ORDER BY teams.name,
+ teams.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name list-teams-by-district :? :*
-- :doc lists all existing team records related to a given district
-SELECT *
+SELECT *
FROM teams
WHERE teams.district_id = :id
-ORDER BY teams.name
+ORDER BY teams.name,
+ teams.id
-- :name list-visits :? :*
-- :doc lists all existing visit records
@@ -317,67 +738,79 @@ SELECT * FROM visits
-- :name list-visits-by-address :? :*
-- :doc lists all existing visit records related to a given address
-SELECT *
+SELECT *
FROM visits
WHERE visits.address_id = :id
-- :name list-visits-by-canvasser :? :*
-- :doc lists all existing visit records related to a given canvasser
-SELECT *
+SELECT *
FROM visits
WHERE visits.canvasser_id = :id
-- :name search-strings-address :? :1
-- :doc selects existing address records having any string field matching `:pattern` by substring match
SELECT * FROM addresses
-WHERE
+WHERE
address LIKE '%:pattern%'
OR phone LIKE '%:pattern%'
ORDER BY addresses.address,
- addresses.postcode
+ addresses.postcode,
+ addresses.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-canvasser :? :1
-- :doc selects existing canvasser records having any string field matching `:pattern` by substring match
SELECT * FROM canvassers
-WHERE
+WHERE
username LIKE '%:pattern%'
OR fullname LIKE '%:pattern%'
OR phone LIKE '%:pattern%'
OR email LIKE '%:pattern%'
ORDER BY canvassers.username,
canvassers.fullname,
- canvassers.email
+ canvassers.email,
+ canvassers.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-district :? :1
-- :doc selects existing district records having any string field matching `:pattern` by substring match
SELECT * FROM districts
-WHERE
+WHERE
name LIKE '%:pattern%'
-ORDER BY districts.name
+ORDER BY districts.name,
+ districts.id
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-dwelling :? :1
+-- :doc selects existing dwelling records having any string field matching `:pattern` by substring match
+SELECT * FROM dwellings
+WHERE
+sub-address LIKE '%:pattern%'
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-elector :? :1
-- :doc selects existing elector records having any string field matching `:pattern` by substring match
SELECT * FROM electors
-WHERE
+WHERE
name LIKE '%:pattern%'
OR phone LIKE '%:pattern%'
OR email LIKE '%:pattern%'
ORDER BY electors.name,
electors.phone,
- electors.email
+ electors.email,
+ electors.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-issue :? :1
-- :doc selects existing issue records having any string field matching `:pattern` by substring match
SELECT * FROM issues
-WHERE
+WHERE
url LIKE '%:pattern%'
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@@ -385,17 +818,19 @@ url LIKE '%:pattern%'
-- :name search-strings-role :? :1
-- :doc selects existing role records having any string field matching `:pattern` by substring match
SELECT * FROM roles
-WHERE
+WHERE
name LIKE '%:pattern%'
-ORDER BY roles.name
+ORDER BY roles.name,
+ roles.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-team :? :1
-- :doc selects existing team records having any string field matching `:pattern` by substring match
SELECT * FROM teams
-WHERE
+WHERE
name LIKE '%:pattern%'
-ORDER BY teams.name
+ORDER BY teams.name,
+ teams.id
--~ (if (:offset params) "OFFSET :offset ")
---~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
\ No newline at end of file
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
diff --git a/src/clj/youyesyet/routes/auto_json_routes.clj b/src/clj/youyesyet/routes/auto_json_routes.clj
index 8d3d707..c9732cd 100644
--- a/src/clj/youyesyet/routes/auto_json_routes.clj
+++ b/src/clj/youyesyet/routes/auto_json_routes.clj
@@ -11,7 +11,7 @@
(declare
- create-addresse
+ create-address
create-authority
create-canvasser
create-district
@@ -30,7 +30,7 @@
create-teammembership
create-teamorganisership
create-visit
- delete-addresse
+ delete-address
delete-authority
delete-canvasser
delete-district
@@ -41,7 +41,7 @@
delete-issue
delete-option
delete-visit
- get-addresse
+ get-address
get-authority
get-canvasser
get-district
@@ -61,7 +61,7 @@
list-canvassers-by-elector
list-districts
list-electors
- list-electors-by-addresse
+ list-electors-by-address
list-followupactions
list-followupactions-by-canvasser
list-followupactions-by-followuprequest
@@ -96,9 +96,9 @@
list-teams
list-teams-by-district
list-visits
- list-visits-by-addresse
+ list-visits-by-address
list-visits-by-canvasser
- update-addresse
+ update-address
update-canvasser
update-district
update-elector
@@ -110,7 +110,7 @@
(defroutes
auto-rest-routes
- (POST "/json/auto/create-addresse" request (create-addresse request))
+ (POST "/json/auto/create-addresse" request (create-address request))
(POST
"/json/auto/create-authority"
request
@@ -162,7 +162,7 @@
request
(create-teamorganisership request))
(POST "/json/auto/create-visit" request (create-visit request))
- (POST "/json/auto/delete-addresse" request (delete-addresse request))
+ (POST "/json/auto/delete-addresse" request (delete-address request))
(POST
"/json/auto/delete-authority"
request
@@ -382,10 +382,10 @@
(defn
- create-addresse
+ create-address
"Auto-generated method to insert one record to the addresses table. Expects the following key(s) to be present in `params`: (:id :address :postcode :phone :district_id :latitude :longitude). Returns a map containing the keys (:id) identifying the record created."
[{:keys [params]}]
- (do (db/create-addresse! params)))
+ (do (db/create-address! params)))
(defn
@@ -515,10 +515,10 @@
(defn
- delete-addresse
+ delete-address
"Auto-generated method to delete one record from the addresses table. Expects the following key(s) to be present in `params`: (:id)."
[{:keys [params]}]
- (do (db/delete-addresse! params))
+ (do (db/delete-address! params))
(response/found "/"))
@@ -970,10 +970,10 @@
(defn
- update-addresse
+ update-address
"Auto-generated method to update one record in the addresses table. Expects the following key(s) to be present in `params`: (:address :district_id :id :latitude :longitude :phone :postcode)."
[{:keys [params]}]
- (do (db/update-addresse! params))
+ (do (db/update-address! params))
(response/found "/"))
diff --git a/youyesyet.adl.xml b/youyesyet.adl.xml
new file mode 100644
index 0000000..54e6214
--- /dev/null
+++ b/youyesyet.adl.xml
@@ -0,0 +1,392 @@
+
+
+
+
+ A web-app intended to be used by canvassers campaigning for a 'Yes' vote in the second independence referendum.
+
+ The web-app will be delivered to canvassers out knocking doors primarily through an HTML5/React single-page app designed to work on a mobile phone; it's possible that someone else may do an Android of iPhone native app to address the same back end but at present I have no plans for this.
+
+ There must also be an administrative interface through which privileged users can set the system up and authorise canvassers, and a 'followup' interface through which issue-expert specialist canvassers can address particular electors' queries.
+
+
+
+
+
+
+
+ See
+ https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/488478/Bulk_Data_Transfer_-_additional_validation_valid_from_12_November_2015.pdf,
+ section 3
+ A valid postcode.
+
+
+ All users
+
+
+ All users of the canvasser app Able to read and add canvassing data in a limited
+ radius around their current position.
+
+
+ Organisers of canvassing teams Able to see and modify data on the canvassers in
+ the team(s) they organise; able to add canvassers to their team; able to update canvassers in
+ their team, including resetting passwords and locking accounts; able to see canvass data over
+ the whole area in which their team operates.
+
+
+ People expert on particular issues. Able to read followup requests, and the electors to which they
+ relate; able to access (read/write) the issues wiki; able to write followuop action records.
+
+
+
+ Users entitled to see an overview of the canvassing data collected. Able to read canvassing data over the whole map, including historical
+ data.
+
+
+ Users responsible for determining what issues should be current at any time.
+ Able to set current issues; able to add issues.
+
+
+ Able to read and update canvasser records, team membership records, team
+ organisership records, issue expertise records; able to add and update reference data
+ generally.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Issues believed to be of interest to electors, about which they may have questions.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Link table.
+
+
+
+
+
+
+
+
+
+
+
+ Primary users of the system: those actually interviewing electors.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ But only their own record
+
+
+ But only canvassers in their own team.
+
+
+ All canvassers
+
+
+
+ Requests for a followup with an issue expert
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+ A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ But only their own group(s)
+
+
+ All groups
+
+
+
+ Electoral districts
+
+
+
+
+
+
+
+
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+ Actions taken on followup requests.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ But only for electors in their immediate vicinity
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+
+
+
+ Options in the election or referendum being canvassed on
+
+
+
+
+
+
+
+ Link table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
index 0fa1f0a..4bdbeee 100644
--- a/youyesyet.canonical.adl.xml
+++ b/youyesyet.canonical.adl.xml
@@ -1,11 +1,33 @@
-
+
+
+
+
+ A web-app intended to be used by canvassers campaigning for a 'Yes' vote in the second independence referendum.
+
+ The web-app will be delivered to canvassers out knocking doors primarily through an HTML5/React single-page app designed to work on a mobile phone; it's possible that someone else may do an Android of iPhone native app to address the same back end but at present I have no plans for this.
+
+ There must also be an administrative interface through which privileged users can set the system up and authorise canvassers, and a 'followup' interface through which issue-expert specialist canvassers can address particular electors' queries.
+
-
+ See
https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/488478/Bulk_Data_Transfer_-_additional_validation_valid_from_12_November_2015.pdf,
section 3
@@ -18,7 +40,7 @@
All users of the canvasser app Able to read and add canvassing data in a limited
radius around their current position.
-
+ Organisers of canvassing teams Able to see and modify data on the canvassers in
the team(s) they organise; able to add canvassers to their team; able to update canvassers in
their team, including resetting passwords and locking accounts; able to see canvass data over
@@ -42,30 +64,32 @@
organisership records, issue expertise records; able to add and update reference data
generally.
-
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
@@ -73,9 +97,35 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -96,16 +146,19 @@
-
+ dwe
-
-
+
+
+
@@ -124,6 +177,9 @@
+
@@ -131,6 +187,9 @@
+
Issues believed to be of interest to electors, about which they may have questions.
@@ -144,21 +203,42 @@
-
-
+
+
-
+
+ Link table.
+
+
+
+
+ Auto-generated abstract primary key
+
+
+
-
+
+
+
+
+
+
+
+
+
Primary users of the system: those actually interviewing electors.
@@ -184,7 +264,7 @@
-
+
@@ -200,35 +280,59 @@
All canvassers
+
Requests for a followup with an issue expert
-
+
-
+
-
+
-
+
-
+
+ Link table
+
+
+
+
+ Auto-generated abstract primary key
+
+
+
+
+
+
+
+
+
+
+
A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.
@@ -240,8 +344,10 @@
+
- Teams of canvassers who work together under common leadership.
@@ -267,6 +373,9 @@
All groups
+
Electoral districts
@@ -280,19 +389,40 @@
-
+
+ Link table
+
+
+
+
+ Auto-generated abstract primary key
+
+
+
+
+
+
+
+
+
+
+
Actions taken on followup requests.
-
+
@@ -317,18 +447,39 @@
-
+
+ Link table
-
+
+
+
+
+ Auto-generated abstract primary key
+
+
+
+
-
+
+
+
+
+
+
+
+
+
Options in the election or referendum being canvassed on
@@ -337,18 +488,39 @@
-
+
+ Link table
+
+
+
+
+ Auto-generated abstract primary key
+
+
+
+
+
+
+
+
+
+
+
-
+
From 79bf3ed7eb93c43a0bb3692153fb0e5ff81c13cb Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Tue, 5 Jun 2018 09:26:36 +0100
Subject: [PATCH 09/51] More work on ADL.
---
youyesyet.adl.xml | 62 +++++++++++++++++++++----------------
youyesyet.canonical.adl.xml | 57 +++++++++++++++++-----------------
2 files changed, 65 insertions(+), 54 deletions(-)
diff --git a/youyesyet.adl.xml b/youyesyet.adl.xml
index 54e6214..18884fd 100644
--- a/youyesyet.adl.xml
+++ b/youyesyet.adl.xml
@@ -1,9 +1,9 @@
-
+
+ xmlns="http://bowyer.journeyman.cc/adl/1.4.1/"
+ xmlns:adl="http://bowyer.journeyman.cc/adl/1.4.1/">
A web-app intended to be used by canvassers campaigning for a 'Yes' vote in the second independence referendum.
@@ -55,7 +55,7 @@
generally.
-
+
@@ -64,9 +64,8 @@
-
-
+
+
@@ -81,7 +80,7 @@
-
+
@@ -90,7 +89,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -120,7 +130,7 @@
-
+
@@ -140,14 +150,14 @@
-
+
-
+ Issues believed to be of interest to electors, about which they may have questions.
@@ -163,7 +173,7 @@
-
+ Link table.
@@ -178,7 +188,7 @@
-
+ Primary users of the system: those actually interviewing electors.
@@ -221,7 +231,7 @@
All canvassers
-
+ Requests for a followup with an issue expert
@@ -245,7 +255,7 @@
-
+ Link table
@@ -256,7 +266,7 @@
-
+ A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.
@@ -267,7 +277,7 @@
-
+
@@ -294,7 +304,7 @@
All groups
-
+ Electoral districts
@@ -307,7 +317,7 @@
-
+ Link table
@@ -318,7 +328,7 @@
-
+ Actions taken on followup requests.
@@ -348,7 +358,7 @@
-
+ Link table
@@ -363,7 +373,7 @@
-
+ Options in the election or referendum being canvassed on
@@ -371,7 +381,7 @@
-
+ Link table
@@ -382,7 +392,7 @@
-
+
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
index 4bdbeee..9939cad 100644
--- a/youyesyet.canonical.adl.xml
+++ b/youyesyet.canonical.adl.xml
@@ -1,12 +1,11 @@
-
-
+
+
-
+
@@ -88,10 +87,10 @@
-
-
+
+
-
+
@@ -111,8 +110,10 @@
-
-
+
+
@@ -126,7 +127,7 @@
-
+
@@ -146,7 +147,7 @@
- dwe
+
@@ -159,7 +160,7 @@
-
+
@@ -180,7 +181,7 @@
-
+
@@ -190,7 +191,7 @@
-
+ Issues believed to be of interest to electors, about which they may have questions.
@@ -209,7 +210,7 @@
-
+ Link table.
@@ -239,7 +240,7 @@
-
+ Primary users of the system: those actually interviewing electors.
@@ -283,7 +284,7 @@
-
+ Requests for a followup with an issue expert
@@ -306,7 +307,7 @@
-
+ Link table
@@ -333,7 +334,7 @@
-
+ A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.
@@ -347,7 +348,7 @@
-
+
@@ -376,7 +377,7 @@
-
+ Electoral districts
@@ -392,7 +393,7 @@
-
+ Link table
@@ -419,7 +420,7 @@
-
+ Actions taken on followup requests.
@@ -450,7 +451,7 @@
-
+ Link table
@@ -480,7 +481,7 @@
-
+ Options in the election or referendum being canvassed on
@@ -491,7 +492,7 @@
-
+ Link table
@@ -518,7 +519,7 @@
-
+
From 85b54fbd607861fde48863cfe11c0174ac1a25be Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Sun, 10 Jun 2018 22:31:12 +0100
Subject: [PATCH 10/51] #47, #48, #49, #50: Auto-generated admin system largely
done
This work is closely coupled with work on [ADL](https://github.com/simon-brooke/adl), q.v. At present ADL largely supports this project.
---
.gitignore | 2 +-
resources/sql/queries.auto.sql | 314 ++++++++-
.../templates/auto/application-index.html | 204 ++++++
.../auto/form-addresses-Address.html | 232 +++++++
.../auto/form-canvassers-Canvasser.html | 317 +++++++++
.../auto/form-districts-District.html | 82 +++
.../auto/form-dwellings-Dwelling.html | 120 ++++
.../templates/auto/form-electors-Elector.html | 212 ++++++
.../form-followupactions-Followupaction.html | 204 ++++++
.../templates/auto/form-issues-Issue.html | 123 ++++
resources/templates/auto/form-roles-Role.html | 82 +++
resources/templates/auto/form-teams-Team.html | 195 ++++++
.../templates/auto/form-visits-Visit.html | 148 ++++
.../auto/list-addresses-Addresses.html | 115 ++++
.../auto/list-canvassers-Canvassers.html | 133 ++++
.../auto/list-districts-Districts.html | 70 ++
.../auto/list-dwellings-Dwellings.html | 79 +++
.../auto/list-electors-Electors.html | 106 +++
.../list-followupactions-Followupactions.html | 106 +++
.../templates/auto/list-issues-Issues.html | 79 +++
.../templates/auto/list-roles-Roles.html | 70 ++
.../templates/auto/list-teams-Teams.html | 97 +++
.../templates/auto/list-visits-Visits.html | 88 +++
src/clj/youyesyet/authorisation.clj | 4 +
src/clj/youyesyet/routes/auto.clj | 639 ++++++++++++++++++
youyesyet.adl.xml | 38 +-
youyesyet.canonical.adl.xml | 82 ++-
27 files changed, 3894 insertions(+), 47 deletions(-)
create mode 100644 resources/templates/auto/application-index.html
create mode 100644 resources/templates/auto/form-addresses-Address.html
create mode 100644 resources/templates/auto/form-canvassers-Canvasser.html
create mode 100644 resources/templates/auto/form-districts-District.html
create mode 100644 resources/templates/auto/form-dwellings-Dwelling.html
create mode 100644 resources/templates/auto/form-electors-Elector.html
create mode 100644 resources/templates/auto/form-followupactions-Followupaction.html
create mode 100644 resources/templates/auto/form-issues-Issue.html
create mode 100644 resources/templates/auto/form-roles-Role.html
create mode 100644 resources/templates/auto/form-teams-Team.html
create mode 100644 resources/templates/auto/form-visits-Visit.html
create mode 100644 resources/templates/auto/list-addresses-Addresses.html
create mode 100644 resources/templates/auto/list-canvassers-Canvassers.html
create mode 100644 resources/templates/auto/list-districts-Districts.html
create mode 100644 resources/templates/auto/list-dwellings-Dwellings.html
create mode 100644 resources/templates/auto/list-electors-Electors.html
create mode 100644 resources/templates/auto/list-followupactions-Followupactions.html
create mode 100644 resources/templates/auto/list-issues-Issues.html
create mode 100644 resources/templates/auto/list-roles-Roles.html
create mode 100644 resources/templates/auto/list-teams-Teams.html
create mode 100644 resources/templates/auto/list-visits-Visits.html
create mode 100644 src/clj/youyesyet/authorisation.clj
create mode 100644 src/clj/youyesyet/routes/auto.clj
diff --git a/.gitignore b/.gitignore
index e65e38a..bf93d93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,4 +21,4 @@ pom.xml.asc
*-init.clj
profiles\.clj
.bowerrc
-bower.json
\ No newline at end of file
+bower.json
diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql
index a80bf0f..b199ca0 100644
--- a/resources/sql/queries.auto.sql
+++ b/resources/sql/queries.auto.sql
@@ -1,11 +1,11 @@
-- File queries.sql
-- autogenerated by adl.to-hugsql-queries at
--- 2018-05-26T15:03:25.295Z
+-- 2018-06-05T12:33:53.043Z
-- See [Application Description Language](https://github.com/simon-brooke/adl).
--- :name create-address! :! :n
+-- :name create-address! :! :n
-- :doc creates a new address record
INSERT INTO addresses (address,
postcode,
@@ -21,13 +21,13 @@ VALUES (:address,
:longitude)
returning id
--- :name create-authority! :! :n
+-- :name create-authority! :! :n
-- :doc creates a new authority record
INSERT INTO authorities (id)
VALUES (:id)
returning id
--- :name create-canvasser! :! :n
+-- :name create-canvasser! :! :n
-- :doc creates a new canvasser record
INSERT INTO canvassers (username,
fullname,
@@ -36,7 +36,8 @@ INSERT INTO canvassers (username,
phone,
email,
authority_id,
- authorised)
+ authorised,
+ roles)
VALUES (:username,
:fullname,
:elector_id,
@@ -44,16 +45,17 @@ VALUES (:username,
:phone,
:email,
:authority_id,
- :authorised)
+ :authorised,
+ :roles)
returning id
--- :name create-district! :! :n
+-- :name create-district! :! :n
-- :doc creates a new district record
INSERT INTO districts (name)
VALUES (:name)
returning id
--- :name create-dwelling! :! :n
+-- :name create-dwelling! :! :n
-- :doc creates a new dwelling record
INSERT INTO dwellings (address_id,
sub-address)
@@ -61,7 +63,7 @@ VALUES (:address_id,
:sub-address)
returning id
--- :name create-elector! :! :n
+-- :name create-elector! :! :n
-- :doc creates a new elector record
INSERT INTO electors (name,
dwelling_id,
@@ -75,7 +77,7 @@ VALUES (:name,
:gender)
returning id
--- :name create-followupaction! :! :n
+-- :name create-followupaction! :! :n
-- :doc creates a new followupaction record
INSERT INTO followupactions (request_id,
actor,
@@ -89,13 +91,13 @@ VALUES (:request_id,
:closed)
returning id
--- :name create-followupmethod! :! :n
+-- :name create-followupmethod! :! :n
-- :doc creates a new followupmethod record
INSERT INTO followupmethods (id)
VALUES (:id)
returning id
--- :name create-followuprequest! :! :n
+-- :name create-followuprequest! :! :n
-- :doc creates a new followuprequest record
INSERT INTO followuprequests (elector_id,
visit_id,
@@ -107,13 +109,13 @@ VALUES (:elector_id,
:method_id)
returning id
--- :name create-gender! :! :n
+-- :name create-gender! :! :n
-- :doc creates a new gender record
INSERT INTO genders (id)
VALUES (:id)
returning id
--- :name create-intention! :! :n
+-- :name create-intention! :! :n
-- :doc creates a new intention record
INSERT INTO intentions (visit_id,
elector_id,
@@ -123,7 +125,7 @@ VALUES (:visit_id,
:option_id)
returning Id
--- :name create-issue! :! :n
+-- :name create-issue! :! :n
-- :doc creates a new issue record
INSERT INTO issues (url,
current,
@@ -133,8 +135,8 @@ VALUES (:url,
:id)
returning id
--- :name create-issueexpertis! :! :n
--- :doc creates a new issueexpertis record
+-- :name create-issueexpertise! :! :n
+-- :doc creates a new issueexpertise record
INSERT INTO issueexpertise (canvasser_id,
issue_id,
method_id)
@@ -143,19 +145,19 @@ VALUES (:canvasser_id,
:method_id)
returning Id
--- :name create-option! :! :n
+-- :name create-option! :! :n
-- :doc creates a new option record
INSERT INTO options (id)
VALUES (:id)
returning id
--- :name create-role! :! :n
+-- :name create-role! :! :n
-- :doc creates a new role record
INSERT INTO roles (name)
VALUES (:name)
returning id
--- :name create-rolemembership! :! :n
+-- :name create-rolemembership! :! :n
-- :doc creates a new rolemembership record
INSERT INTO rolememberships (role_id,
canvasser_id)
@@ -163,7 +165,7 @@ VALUES (:role_id,
:canvasser_id)
returning Id
--- :name create-team! :! :n
+-- :name create-team! :! :n
-- :doc creates a new team record
INSERT INTO teams (name,
district_id,
@@ -175,7 +177,7 @@ VALUES (:name,
:longitude)
returning id
--- :name create-teammembership! :! :n
+-- :name create-teammembership! :! :n
-- :doc creates a new teammembership record
INSERT INTO teammemberships (team_id,
canvasser_id)
@@ -183,7 +185,7 @@ VALUES (:team_id,
:canvasser_id)
returning Id
--- :name create-teamorganisership! :! :n
+-- :name create-teamorganisership! :! :n
-- :doc creates a new teamorganisership record
INSERT INTO teamorganiserships (team_id,
canvasser_id)
@@ -191,7 +193,7 @@ VALUES (:team_id,
:canvasser_id)
returning Id
--- :name create-visit! :! :n
+-- :name create-visit! :! :n
-- :doc creates a new visit record
INSERT INTO visits (address_id,
canvasser_id,
@@ -261,8 +263,8 @@ WHERE intentions.Id = :Id
DELETE FROM issues
WHERE issues.id = :id
--- :name delete-issueexpertis! :! :n
--- :doc updates an existing issueexpertis record
+-- :name delete-issueexpertise! :! :n
+-- :doc updates an existing issueexpertise record
DELETE FROM issueexpertise
WHERE issueexpertise.Id = :Id
@@ -323,6 +325,15 @@ ORDER BY canvassers.username,
canvassers.email,
canvassers.id
+-- :name get-canvasser-by-username :? :1
+-- :doc selects an existing canvasser record
+SELECT * FROM canvassers
+WHERE canvassers.username = :username
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email,
+ canvassers.id
+
-- :name get-district :? :1
-- :doc selects an existing district record
SELECT * FROM districts
@@ -374,8 +385,8 @@ WHERE intentions.Id = :Id
SELECT * FROM issues
WHERE issues.id = :id
--- :name get-issueexpertis :? :1
--- :doc selects an existing issueexpertis record
+-- :name get-issueexpertise :? :1
+-- :doc selects an existing issueexpertise record
SELECT * FROM issueexpertise
WHERE issueexpertise.Id = :Id
@@ -482,6 +493,16 @@ ORDER BY canvassers.username,
canvassers.email,
canvassers.id
+-- :name list-canvassers-by-role :? :*
+-- :doc lists all existing canvasser records related to a given role
+SELECT *
+FROM canvassers
+WHERE canvassers.roles = :id
+ORDER BY canvassers.username,
+ canvassers.fullname,
+ canvassers.email,
+ canvassers.id
+
-- :name list-districts :? :*
-- :doc lists all existing district records
SELECT * FROM districts
@@ -496,8 +517,8 @@ SELECT * FROM dwellings
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
--- :name list-dwellings-by-addres :? :*
--- :doc lists all existing dwelling records related to a given addres
+-- :name list-dwellings-by-address :? :*
+-- :doc lists all existing dwelling records related to a given address
SELECT *
FROM dwellings
WHERE dwellings.address_id = :id
@@ -617,25 +638,25 @@ FROM intentions
WHERE intentions.visit_id = :id
-- :name list-issueexpertise :? :*
--- :doc lists all existing issueexpertis records
+-- :doc lists all existing issueexpertise records
SELECT * FROM issueexpertise
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name list-issueexpertise-by-canvasser :? :*
--- :doc lists all existing issueexpertis records related to a given canvasser
+-- :doc lists all existing issueexpertise records related to a given canvasser
SELECT *
FROM issueexpertise
WHERE issueexpertise.canvasser_id = :id
-- :name list-issueexpertise-by-followupmethod :? :*
--- :doc lists all existing issueexpertis records related to a given followupmethod
+-- :doc lists all existing issueexpertise records related to a given followupmethod
SELECT *
FROM issueexpertise
WHERE issueexpertise.method_id = :id
-- :name list-issueexpertise-by-issue :? :*
--- :doc lists all existing issueexpertis records related to a given issue
+-- :doc lists all existing issueexpertise records related to a given issue
SELECT *
FROM issueexpertise
WHERE issueexpertise.issue_id = :id
@@ -760,6 +781,14 @@ ORDER BY addresses.address,
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name search-strings-authority :? :1
+-- :doc selects existing authority records having any string field matching `:pattern` by substring match
+SELECT * FROM authorities
+WHERE
+id LIKE '%:pattern%'
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
-- :name search-strings-canvasser :? :1
-- :doc selects existing canvasser records having any string field matching `:pattern` by substring match
SELECT * FROM canvassers
@@ -807,11 +836,65 @@ ORDER BY electors.name,
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name search-strings-followupaction :? :1
+-- :doc selects existing followupaction records having any string field matching `:pattern` by substring match
+SELECT * FROM followupactions
+WHERE
+notes LIKE '%:pattern%'
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-followupmethod :? :1
+-- :doc selects existing followupmethod records having any string field matching `:pattern` by substring match
+SELECT * FROM followupmethods
+WHERE
+id LIKE '%:pattern%'
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-followuprequest :? :1
+-- :doc selects existing followuprequest records having any string field matching `:pattern` by substring match
+SELECT * FROM followuprequests
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-gender :? :1
+-- :doc selects existing gender records having any string field matching `:pattern` by substring match
+SELECT * FROM genders
+WHERE
+id LIKE '%:pattern%'
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-intention :? :1
+-- :doc selects existing intention records having any string field matching `:pattern` by substring match
+SELECT * FROM intentions
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
-- :name search-strings-issue :? :1
-- :doc selects existing issue records having any string field matching `:pattern` by substring match
SELECT * FROM issues
WHERE
url LIKE '%:pattern%'
+ OR id LIKE '%:pattern%'
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-issueexpertise :? :1
+-- :doc selects existing issueexpertise records having any string field matching `:pattern` by substring match
+SELECT * FROM issueexpertise
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-option :? :1
+-- :doc selects existing option records having any string field matching `:pattern` by substring match
+SELECT * FROM options
+WHERE
+id LIKE '%:pattern%'
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@@ -825,6 +908,13 @@ ORDER BY roles.name,
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+-- :name search-strings-rolemembership :? :1
+-- :doc selects existing rolemembership records having any string field matching `:pattern` by substring match
+SELECT * FROM rolememberships
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
-- :name search-strings-team :? :1
-- :doc selects existing team records having any string field matching `:pattern` by substring match
SELECT * FROM teams
@@ -834,3 +924,159 @@ ORDER BY teams.name,
teams.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-teammembership :? :1
+-- :doc selects existing teammembership records having any string field matching `:pattern` by substring match
+SELECT * FROM teammemberships
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-teamorganisership :? :1
+-- :doc selects existing teamorganisership records having any string field matching `:pattern` by substring match
+SELECT * FROM teamorganiserships
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name search-strings-visit :? :1
+-- :doc selects existing visit records having any string field matching `:pattern` by substring match
+SELECT * FROM visits
+WHERE
+--~ (if (:offset params) "OFFSET :offset ")
+--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
+
+-- :name update-address! :! :n
+-- :doc updates an existing address record
+UPDATE addresses
+SET address = :address,
+ postcode = :postcode,
+ phone = :phone,
+ district_id = :district_id,
+ latitude = :latitude,
+ longitude = :longitude
+WHERE addresses.id = :id
+
+-- :name update-canvasser! :! :n
+-- :doc updates an existing canvasser record
+UPDATE canvassers
+SET username = :username,
+ fullname = :fullname,
+ elector_id = :elector_id,
+ address_id = :address_id,
+ phone = :phone,
+ email = :email,
+ authority_id = :authority_id,
+ authorised = :authorised,
+ roles = :roles
+WHERE canvassers.id = :id
+
+-- :name update-district! :! :n
+-- :doc updates an existing district record
+UPDATE districts
+SET name = :name
+WHERE districts.id = :id
+
+-- :name update-dwelling! :! :n
+-- :doc updates an existing dwelling record
+UPDATE dwellings
+SET address_id = :address_id,
+ sub-address = :sub-address
+WHERE dwellings.id = :id
+
+-- :name update-elector! :! :n
+-- :doc updates an existing elector record
+UPDATE electors
+SET name = :name,
+ dwelling_id = :dwelling_id,
+ phone = :phone,
+ email = :email,
+ gender = :gender
+WHERE electors.id = :id
+
+-- :name update-followupaction! :! :n
+-- :doc updates an existing followupaction record
+UPDATE followupactions
+SET request_id = :request_id,
+ actor = :actor,
+ date = :date,
+ notes = :notes,
+ closed = :closed
+WHERE followupactions.id = :id
+
+-- :name update-followuprequest! :! :n
+-- :doc updates an existing followuprequest record
+UPDATE followuprequests
+SET elector_id = :elector_id,
+ visit_id = :visit_id,
+ issue_id = :issue_id,
+ method_id = :method_id
+WHERE followuprequests.id = :id
+
+-- :name update-intention! :! :n
+-- :doc updates an existing intention record
+UPDATE intentions
+SET visit_id = :visit_id,
+ elector_id = :elector_id,
+ option_id = :option_id
+WHERE intentions.Id = :Id
+
+-- :name update-issue! :! :n
+-- :doc updates an existing issue record
+UPDATE issues
+SET url = :url,
+ current = :current,
+ id = :id
+WHERE issues.id = :id
+
+-- :name update-issueexpertise! :! :n
+-- :doc updates an existing issueexpertise record
+UPDATE issueexpertise
+SET canvasser_id = :canvasser_id,
+ issue_id = :issue_id,
+ method_id = :method_id
+WHERE issueexpertise.Id = :Id
+
+-- :name update-role! :! :n
+-- :doc updates an existing role record
+UPDATE roles
+SET name = :name
+WHERE roles.id = :id
+
+-- :name update-rolemembership! :! :n
+-- :doc updates an existing rolemembership record
+UPDATE rolememberships
+SET role_id = :role_id,
+ canvasser_id = :canvasser_id
+WHERE rolememberships.Id = :Id
+
+-- :name update-team! :! :n
+-- :doc updates an existing team record
+UPDATE teams
+SET name = :name,
+ district_id = :district_id,
+ latitude = :latitude,
+ longitude = :longitude
+WHERE teams.id = :id
+
+-- :name update-teammembership! :! :n
+-- :doc updates an existing teammembership record
+UPDATE teammemberships
+SET team_id = :team_id,
+ canvasser_id = :canvasser_id
+WHERE teammemberships.Id = :Id
+
+-- :name update-teamorganisership! :! :n
+-- :doc updates an existing teamorganisership record
+UPDATE teamorganiserships
+SET team_id = :team_id,
+ canvasser_id = :canvasser_id
+WHERE teamorganiserships.Id = :Id
+
+-- :name update-visit! :! :n
+-- :doc updates an existing visit record
+UPDATE visits
+SET address_id = :address_id,
+ canvasser_id = :canvasser_id,
+ date = :date
+WHERE visits.id = :id
diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html
new file mode 100644
index 0000000..ace787c
--- /dev/null
+++ b/resources/templates/auto/application-index.html
@@ -0,0 +1,204 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+ {% block foot %}
+
+ {% endblock %}
+ {% endblock %}
+
+ {% block extra-script %}
+ {% endblock %}
+
+
+
+
+
+
diff --git a/resources/templates/base-unauthenticated.html b/resources/templates/base.html
similarity index 96%
rename from resources/templates/base-unauthenticated.html
rename to resources/templates/base.html
index 4e41c8f..cfb278f 100644
--- a/resources/templates/base-unauthenticated.html
+++ b/resources/templates/base.html
@@ -1,5 +1,6 @@
-
+
diff --git a/src/clj/youyesyet/handler.clj b/src/clj/youyesyet/handler.clj
index 789564f..40f95cf 100644
--- a/src/clj/youyesyet/handler.clj
+++ b/src/clj/youyesyet/handler.clj
@@ -6,7 +6,8 @@
[youyesyet.routes.authenticated :refer [authenticated-routes]]
[youyesyet.routes.home :refer [home-routes]]
[youyesyet.routes.oauth :refer [oauth-routes]]
- [youyesyet.routes.auto-json-routes :refer [auto-rest-routes]]
+ [youyesyet.routes.auto-json :refer [auto-rest-routes]]
+ [youyesyet.routes.auto :refer [auto-selmer-routes]]
[compojure.route :as route]
[youyesyet.env :refer [defaults]]
[mount.core :as mount]
@@ -67,6 +68,9 @@
(-> #'auto-rest-routes
(wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats))
+ (-> #'auto-selmer-routes
+ (wrap-routes middleware/wrap-csrf)
+ (wrap-routes middleware/wrap-formats))
#'oauth-routes
#'authenticated-routes
(route/not-found
@@ -75,5 +79,5 @@
:title "page not found"})))))
-(def app #'app-routes)
- ;;(middleware/wrap-base #'app-routes))
+(def app ;; #'app-routes)
+ (middleware/wrap-base #'app-routes))
diff --git a/src/clj/youyesyet/routes/auto.clj b/src/clj/youyesyet/routes/auto.clj
index b1951c3..3781e1d 100644
--- a/src/clj/youyesyet/routes/auto.clj
+++ b/src/clj/youyesyet/routes/auto.clj
@@ -1,6 +1,6 @@
(ns
youyesyet.routes.auto
- "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180610T214425.631Z"
+ "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180611T180322.460Z"
(:require
[noir.response :as nresponse]
[noir.util.route :as route]
@@ -8,6 +8,7 @@
[ring.util.http-response :as response]
[clojure.java.io :as io]
[hugsql.core :as hugsql]
+ [youyesyet.layout :as l]
[youyesyet.db.core :as db]
[youyesyet.routes.manual :as m]))
@@ -19,13 +20,13 @@
n
(str "auto/" n)))
-(def resolve-template (memoise raw-resolve-template))
+(def resolve-template (memoize raw-resolve-template))
(defn
index
[r]
- (layout/render
- (resolve-template "application-index")
+ (l/render
+ (resolve-template "application-index.html")
{:title "Administrative menu"}))
(defn
@@ -33,16 +34,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-electors-Electors.html")
- {:title "Electors", :params p, :records (db/search-elector p)})))
+ {:title "Electors",
+ :params p,
+ :records (db/search-strings-elector p)})))
(defn
form-electors-Elector
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-electors-Elector.html")
{:title "Elector", :params p, :record (db/get-elector p)})))
@@ -51,16 +54,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-genders-Genders.html")
- {:title "Genders", :params p, :records (db/search-gender p)})))
+ {:title "Genders",
+ :params p,
+ :records (db/search-strings-gender p)})))
(defn
form-genders-Gender
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-genders-Gender.html")
{:title "Gender", :params p, :record (db/get-gender p)})))
@@ -69,16 +74,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-dwellings-Dwellings.html")
- {:title "Dwellings", :params p, :records (db/search-dwelling p)})))
+ {:title "Dwellings",
+ :params p,
+ :records (db/search-strings-dwelling p)})))
(defn
form-dwellings-Dwelling
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-dwellings-Dwelling.html")
{:title "Dwelling", :params p, :record (db/get-dwelling p)})))
@@ -87,16 +94,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-addresses-Addresses.html")
- {:title "Addresses", :params p, :records (db/search-address p)})))
+ {:title "Addresses",
+ :params p,
+ :records (db/search-strings-address p)})))
(defn
form-addresses-Address
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-addresses-Address.html")
{:title "Address", :params p, :record (db/get-address p)})))
@@ -105,16 +114,16 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-visits-Visits.html")
- {:title "Visits", :params p, :records (db/search-visit p)})))
+ {:title "Visits", :params p, :records (db/search-strings-visit p)})))
(defn
form-visits-Visit
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-visits-Visit.html")
{:title "Visit", :params p, :record (db/get-visit p)})))
@@ -123,18 +132,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-authorities-Authorities.html")
{:title "Authorities",
:params p,
- :records (db/search-authority p)})))
+ :records (db/search-strings-authority p)})))
(defn
form-authorities-Authority
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-authorities-Authority.html")
{:title "Authority", :params p, :record (db/get-authority p)})))
@@ -143,16 +152,16 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-issues-Issues.html")
- {:title "Issues", :params p, :records (db/search-issue p)})))
+ {:title "Issues", :params p, :records (db/search-strings-issue p)})))
(defn
form-issues-Issue
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-issues-Issue.html")
{:title "Issue", :params p, :record (db/get-issue p)})))
@@ -161,16 +170,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-intentions-Intentions.html")
- {:title "Intentions", :params p, :records (db/search-intention p)})))
+ {:title "Intentions",
+ :params p,
+ :records (db/search-strings-intention p)})))
(defn
form-intentions-Intention
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-intentions-Intention.html")
{:title "Intention", :params p, :record (db/get-intention p)})))
@@ -179,16 +190,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-canvassers-Canvassers.html")
- {:title "Canvassers", :params p, :records (db/search-canvasser p)})))
+ {:title "Canvassers",
+ :params p,
+ :records (db/search-strings-canvasser p)})))
(defn
form-canvassers-Canvasser
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-canvassers-Canvasser.html")
{:title "Canvasser", :params p, :record (db/get-canvasser p)})))
@@ -197,18 +210,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-followuprequests-Followuprequests.html")
{:title "Followuprequests",
:params p,
- :records (db/search-followuprequest p)})))
+ :records (db/search-strings-followuprequest p)})))
(defn
form-followuprequests-Followuprequest
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-followuprequests-Followuprequest.html")
{:title "Followuprequest",
:params p,
@@ -219,16 +232,16 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-roles-Roles.html")
- {:title "Roles", :params p, :records (db/search-role p)})))
+ {:title "Roles", :params p, :records (db/search-strings-role p)})))
(defn
form-roles-Role
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-roles-Role.html")
{:title "Role", :params p, :record (db/get-role p)})))
@@ -237,16 +250,16 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-teams-Teams.html")
- {:title "Teams", :params p, :records (db/search-team p)})))
+ {:title "Teams", :params p, :records (db/search-strings-team p)})))
(defn
form-teams-Team
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-teams-Team.html")
{:title "Team", :params p, :record (db/get-team p)})))
@@ -255,16 +268,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-districts-Districts.html")
- {:title "Districts", :params p, :records (db/search-district p)})))
+ {:title "Districts",
+ :params p,
+ :records (db/search-strings-district p)})))
(defn
form-districts-District
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-districts-District.html")
{:title "District", :params p, :record (db/get-district p)})))
@@ -273,18 +288,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-followupactions-Followupactions.html")
{:title "Followupactions",
:params p,
- :records (db/search-followupaction p)})))
+ :records (db/search-strings-followupaction p)})))
(defn
form-followupactions-Followupaction
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-followupactions-Followupaction.html")
{:title "Followupaction",
:params p,
@@ -295,16 +310,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-options-Options.html")
- {:title "Options", :params p, :records (db/search-option p)})))
+ {:title "Options",
+ :params p,
+ :records (db/search-strings-option p)})))
(defn
form-options-Option
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-options-Option.html")
{:title "Option", :params p, :record (db/get-option p)})))
@@ -313,18 +330,18 @@
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "list-followupmethods-Followupmethods.html")
{:title "Followupmethods",
:params p,
- :records (db/search-followupmethod p)})))
+ :records (db/search-strings-followupmethod p)})))
(defn
form-followupmethods-Followupmethod
[r]
(let
[p (:form-params r)]
- (layout/render
+ (l/render
(resolve-template "form-followupmethods-Followupmethod.html")
{:title "Followupmethod",
:params p,
@@ -334,14 +351,21 @@
raw-resolve-handler
"Prefer the manually-written version of the handler with name `n`, if it exists, to the automatically generated one"
[n]
- (let
- [s (symbol (str "m." n))]
- (if (bound? s) (eval s) (eval (symbol n)))))
+ (try
+ (eval (symbol (str "youyesyet" ".routes.manual/" n)))
+ (catch
+ Exception
+ _
+ (eval (symbol (str "youyesyet" ".routes.auto/" n))))))
(def resolve-handler (memoize raw-resolve-handler))
(defroutes
auto-selmer-routes
+ (GET
+ "/index"
+ request
+ (route/restricted (apply (resolve-handler "index") (list request))))
(GET
"/form-addresses-Address"
request
diff --git a/src/clj/youyesyet/routes/auto_json.clj b/src/clj/youyesyet/routes/auto_json.clj
new file mode 100644
index 0000000..9426c90
--- /dev/null
+++ b/src/clj/youyesyet/routes/auto_json.clj
@@ -0,0 +1,1653 @@
+(ns
+ youyesyet.routes.auto-json
+ "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180611T180321.339Z"
+ (:require
+ [noir.response :as nresponse]
+ [noir.util.route :as route]
+ [compojure.core :refer [defroutes GET POST]]
+ [ring.util.http-response :as response]
+ [clojure.java.io :as io]
+ [hugsql.core :as hugsql]
+ [youyesyet.db.core :as db]))
+
+
+(declare
+ create-address!
+ create-authority!
+ create-canvasser!
+ create-district!
+ create-dwelling!
+ create-elector!
+ create-followupaction!
+ create-followupmethod!
+ create-followuprequest!
+ create-gender!
+ create-intention!
+ create-issue!
+ create-issueexpertise!
+ create-option!
+ create-role!
+ create-rolemembership!
+ create-team!
+ create-teammembership!
+ create-teamorganisership!
+ create-visit!
+ delete-address!
+ delete-authority!
+ delete-canvasser!
+ delete-district!
+ delete-dwelling!
+ delete-elector!
+ delete-followupaction!
+ delete-followupmethod!
+ delete-followuprequest!
+ delete-gender!
+ delete-intention!
+ delete-issue!
+ delete-issueexpertise!
+ delete-option!
+ delete-role!
+ delete-rolemembership!
+ delete-team!
+ delete-teammembership!
+ delete-teamorganisership!
+ delete-visit!
+ get-address
+ get-authority
+ get-canvasser
+ get-canvasser-by-username
+ get-district
+ get-dwelling
+ get-elector
+ get-followupaction
+ get-followupmethod
+ get-followuprequest
+ get-gender
+ get-intention
+ get-issue
+ get-issueexpertise
+ get-option
+ get-role
+ get-rolemembership
+ get-team
+ get-teammembership
+ get-teamorganisership
+ get-visit
+ list-addresses
+ list-addresses-by-district
+ list-authorities
+ list-canvassers
+ list-canvassers-by-address
+ list-canvassers-by-authority
+ list-canvassers-by-elector
+ list-canvassers-by-role
+ list-districts
+ list-dwellings
+ list-dwellings-by-address
+ list-electors
+ list-electors-by-dwelling
+ list-electors-by-gender
+ list-followupactions
+ list-followupactions-by-canvasser
+ list-followupactions-by-followuprequest
+ list-followupmethods
+ list-followuprequests
+ list-followuprequests-by-elector
+ list-followuprequests-by-followupmethod
+ list-followuprequests-by-issue
+ list-followuprequests-by-visit
+ list-genders
+ list-intentions
+ list-intentions-by-elector
+ list-intentions-by-option
+ list-intentions-by-visit
+ list-issueexpertise
+ list-issueexpertise-by-canvasser
+ list-issueexpertise-by-followupmethod
+ list-issueexpertise-by-issue
+ list-issues
+ list-options
+ list-rolememberships
+ list-rolememberships-by-canvasser
+ list-rolememberships-by-role
+ list-roles
+ list-roles-by-canvasser
+ list-teammemberships
+ list-teammemberships-by-canvasser
+ list-teammemberships-by-team
+ list-teamorganiserships
+ list-teamorganiserships-by-canvasser
+ list-teamorganiserships-by-team
+ list-teams
+ list-teams-by-canvasser
+ list-teams-by-district
+ list-visits
+ list-visits-by-address
+ list-visits-by-canvasser
+ search-strings-address
+ search-strings-authority
+ search-strings-canvasser
+ search-strings-district
+ search-strings-dwelling
+ search-strings-elector
+ search-strings-followupaction
+ search-strings-followupmethod
+ search-strings-followuprequest
+ search-strings-gender
+ search-strings-intention
+ search-strings-issue
+ search-strings-issueexpertise
+ search-strings-option
+ search-strings-role
+ search-strings-rolemembership
+ search-strings-team
+ search-strings-teammembership
+ search-strings-teamorganisership
+ search-strings-visit
+ update-address!
+ update-canvasser!
+ update-district!
+ update-dwelling!
+ update-elector!
+ update-followupaction!
+ update-followuprequest!
+ update-intention!
+ update-issue!
+ update-issueexpertise!
+ update-role!
+ update-rolemembership!
+ update-team!
+ update-teammembership!
+ update-teamorganisership!
+ update-visit!)
+
+
+(defroutes
+ auto-rest-routes
+ (POST
+ "/json/auto/create-address"
+ request
+ (route/restricted (create-address! request)))
+ (POST
+ "/json/auto/create-authority"
+ request
+ (route/restricted (create-authority! request)))
+ (POST
+ "/json/auto/create-canvasser"
+ request
+ (route/restricted (create-canvasser! request)))
+ (POST
+ "/json/auto/create-district"
+ request
+ (route/restricted (create-district! request)))
+ (POST
+ "/json/auto/create-dwelling"
+ request
+ (route/restricted (create-dwelling! request)))
+ (POST
+ "/json/auto/create-elector"
+ request
+ (route/restricted (create-elector! request)))
+ (POST
+ "/json/auto/create-followupaction"
+ request
+ (route/restricted (create-followupaction! request)))
+ (POST
+ "/json/auto/create-followupmethod"
+ request
+ (route/restricted (create-followupmethod! request)))
+ (POST
+ "/json/auto/create-followuprequest"
+ request
+ (route/restricted (create-followuprequest! request)))
+ (POST
+ "/json/auto/create-gender"
+ request
+ (route/restricted (create-gender! request)))
+ (POST
+ "/json/auto/create-intention"
+ request
+ (route/restricted (create-intention! request)))
+ (POST
+ "/json/auto/create-issue"
+ request
+ (route/restricted (create-issue! request)))
+ (POST
+ "/json/auto/create-issueexpertise"
+ request
+ (route/restricted (create-issueexpertise! request)))
+ (POST
+ "/json/auto/create-option"
+ request
+ (route/restricted (create-option! request)))
+ (POST
+ "/json/auto/create-role"
+ request
+ (route/restricted (create-role! request)))
+ (POST
+ "/json/auto/create-rolemembership"
+ request
+ (route/restricted (create-rolemembership! request)))
+ (POST
+ "/json/auto/create-team"
+ request
+ (route/restricted (create-team! request)))
+ (POST
+ "/json/auto/create-teammembership"
+ request
+ (route/restricted (create-teammembership! request)))
+ (POST
+ "/json/auto/create-teamorganisership"
+ request
+ (route/restricted (create-teamorganisership! request)))
+ (POST
+ "/json/auto/create-visit"
+ request
+ (route/restricted (create-visit! request)))
+ (POST
+ "/json/auto/delete-address"
+ request
+ (route/restricted (delete-address! request)))
+ (POST
+ "/json/auto/delete-authority"
+ request
+ (route/restricted (delete-authority! request)))
+ (POST
+ "/json/auto/delete-canvasser"
+ request
+ (route/restricted (delete-canvasser! request)))
+ (POST
+ "/json/auto/delete-district"
+ request
+ (route/restricted (delete-district! request)))
+ (POST
+ "/json/auto/delete-dwelling"
+ request
+ (route/restricted (delete-dwelling! request)))
+ (POST
+ "/json/auto/delete-elector"
+ request
+ (route/restricted (delete-elector! request)))
+ (POST
+ "/json/auto/delete-followupaction"
+ request
+ (route/restricted (delete-followupaction! request)))
+ (POST
+ "/json/auto/delete-followupmethod"
+ request
+ (route/restricted (delete-followupmethod! request)))
+ (POST
+ "/json/auto/delete-followuprequest"
+ request
+ (route/restricted (delete-followuprequest! request)))
+ (POST
+ "/json/auto/delete-gender"
+ request
+ (route/restricted (delete-gender! request)))
+ (POST
+ "/json/auto/delete-intention"
+ request
+ (route/restricted (delete-intention! request)))
+ (POST
+ "/json/auto/delete-issue"
+ request
+ (route/restricted (delete-issue! request)))
+ (POST
+ "/json/auto/delete-issueexpertise"
+ request
+ (route/restricted (delete-issueexpertise! request)))
+ (POST
+ "/json/auto/delete-option"
+ request
+ (route/restricted (delete-option! request)))
+ (POST
+ "/json/auto/delete-role"
+ request
+ (route/restricted (delete-role! request)))
+ (POST
+ "/json/auto/delete-rolemembership"
+ request
+ (route/restricted (delete-rolemembership! request)))
+ (POST
+ "/json/auto/delete-team"
+ request
+ (route/restricted (delete-team! request)))
+ (POST
+ "/json/auto/delete-teammembership"
+ request
+ (route/restricted (delete-teammembership! request)))
+ (POST
+ "/json/auto/delete-teamorganisership"
+ request
+ (route/restricted (delete-teamorganisership! request)))
+ (POST
+ "/json/auto/delete-visit"
+ request
+ (route/restricted (delete-visit! request)))
+ (POST
+ "/json/auto/get-address"
+ request
+ (route/restricted (get-address request)))
+ (POST
+ "/json/auto/get-authority"
+ request
+ (route/restricted (get-authority request)))
+ (POST
+ "/json/auto/get-canvasser"
+ request
+ (route/restricted (get-canvasser request)))
+ (POST
+ "/json/auto/get-canvasser-by-username"
+ request
+ (route/restricted (get-canvasser-by-username request)))
+ (POST
+ "/json/auto/get-district"
+ request
+ (route/restricted (get-district request)))
+ (POST
+ "/json/auto/get-dwelling"
+ request
+ (route/restricted (get-dwelling request)))
+ (POST
+ "/json/auto/get-elector"
+ request
+ (route/restricted (get-elector request)))
+ (POST
+ "/json/auto/get-followupaction"
+ request
+ (route/restricted (get-followupaction request)))
+ (POST
+ "/json/auto/get-followupmethod"
+ request
+ (route/restricted (get-followupmethod request)))
+ (POST
+ "/json/auto/get-followuprequest"
+ request
+ (route/restricted (get-followuprequest request)))
+ (POST
+ "/json/auto/get-gender"
+ request
+ (route/restricted (get-gender request)))
+ (POST
+ "/json/auto/get-intention"
+ request
+ (route/restricted (get-intention request)))
+ (POST
+ "/json/auto/get-issue"
+ request
+ (route/restricted (get-issue request)))
+ (POST
+ "/json/auto/get-issueexpertise"
+ request
+ (route/restricted (get-issueexpertise request)))
+ (POST
+ "/json/auto/get-option"
+ request
+ (route/restricted (get-option request)))
+ (POST
+ "/json/auto/get-role"
+ request
+ (route/restricted (get-role request)))
+ (POST
+ "/json/auto/get-rolemembership"
+ request
+ (route/restricted (get-rolemembership request)))
+ (POST
+ "/json/auto/get-team"
+ request
+ (route/restricted (get-team request)))
+ (POST
+ "/json/auto/get-teammembership"
+ request
+ (route/restricted (get-teammembership request)))
+ (POST
+ "/json/auto/get-teamorganisership"
+ request
+ (route/restricted (get-teamorganisership request)))
+ (POST
+ "/json/auto/get-visit"
+ request
+ (route/restricted (get-visit request)))
+ (GET
+ "/json/auto/list-addresses"
+ request
+ (route/restricted (list-addresses request)))
+ (GET
+ "/json/auto/list-addresses-by-district"
+ request
+ (route/restricted (list-addresses-by-district request)))
+ (GET
+ "/json/auto/list-authorities"
+ request
+ (route/restricted (list-authorities request)))
+ (GET
+ "/json/auto/list-canvassers"
+ request
+ (route/restricted (list-canvassers request)))
+ (GET
+ "/json/auto/list-canvassers-by-address"
+ request
+ (route/restricted (list-canvassers-by-address request)))
+ (GET
+ "/json/auto/list-canvassers-by-authority"
+ request
+ (route/restricted (list-canvassers-by-authority request)))
+ (GET
+ "/json/auto/list-canvassers-by-elector"
+ request
+ (route/restricted (list-canvassers-by-elector request)))
+ (GET
+ "/json/auto/list-canvassers-by-role"
+ request
+ (route/restricted (list-canvassers-by-role request)))
+ (GET
+ "/json/auto/list-districts"
+ request
+ (route/restricted (list-districts request)))
+ (GET
+ "/json/auto/list-dwellings"
+ request
+ (route/restricted (list-dwellings request)))
+ (GET
+ "/json/auto/list-dwellings-by-address"
+ request
+ (route/restricted (list-dwellings-by-address request)))
+ (GET
+ "/json/auto/list-electors"
+ request
+ (route/restricted (list-electors request)))
+ (GET
+ "/json/auto/list-electors-by-dwelling"
+ request
+ (route/restricted (list-electors-by-dwelling request)))
+ (GET
+ "/json/auto/list-electors-by-gender"
+ request
+ (route/restricted (list-electors-by-gender request)))
+ (GET
+ "/json/auto/list-followupactions"
+ request
+ (route/restricted (list-followupactions request)))
+ (GET
+ "/json/auto/list-followupactions-by-canvasser"
+ request
+ (route/restricted (list-followupactions-by-canvasser request)))
+ (GET
+ "/json/auto/list-followupactions-by-followuprequest"
+ request
+ (route/restricted (list-followupactions-by-followuprequest request)))
+ (GET
+ "/json/auto/list-followupmethods"
+ request
+ (route/restricted (list-followupmethods request)))
+ (GET
+ "/json/auto/list-followuprequests"
+ request
+ (route/restricted (list-followuprequests request)))
+ (GET
+ "/json/auto/list-followuprequests-by-elector"
+ request
+ (route/restricted (list-followuprequests-by-elector request)))
+ (GET
+ "/json/auto/list-followuprequests-by-followupmethod"
+ request
+ (route/restricted (list-followuprequests-by-followupmethod request)))
+ (GET
+ "/json/auto/list-followuprequests-by-issue"
+ request
+ (route/restricted (list-followuprequests-by-issue request)))
+ (GET
+ "/json/auto/list-followuprequests-by-visit"
+ request
+ (route/restricted (list-followuprequests-by-visit request)))
+ (GET
+ "/json/auto/list-genders"
+ request
+ (route/restricted (list-genders request)))
+ (GET
+ "/json/auto/list-intentions"
+ request
+ (route/restricted (list-intentions request)))
+ (GET
+ "/json/auto/list-intentions-by-elector"
+ request
+ (route/restricted (list-intentions-by-elector request)))
+ (GET
+ "/json/auto/list-intentions-by-option"
+ request
+ (route/restricted (list-intentions-by-option request)))
+ (GET
+ "/json/auto/list-intentions-by-visit"
+ request
+ (route/restricted (list-intentions-by-visit request)))
+ (GET
+ "/json/auto/list-issueexpertise"
+ request
+ (route/restricted (list-issueexpertise request)))
+ (GET
+ "/json/auto/list-issueexpertise-by-canvasser"
+ request
+ (route/restricted (list-issueexpertise-by-canvasser request)))
+ (GET
+ "/json/auto/list-issueexpertise-by-followupmethod"
+ request
+ (route/restricted (list-issueexpertise-by-followupmethod request)))
+ (GET
+ "/json/auto/list-issueexpertise-by-issue"
+ request
+ (route/restricted (list-issueexpertise-by-issue request)))
+ (GET
+ "/json/auto/list-issues"
+ request
+ (route/restricted (list-issues request)))
+ (GET
+ "/json/auto/list-options"
+ request
+ (route/restricted (list-options request)))
+ (GET
+ "/json/auto/list-rolememberships"
+ request
+ (route/restricted (list-rolememberships request)))
+ (GET
+ "/json/auto/list-rolememberships-by-canvasser"
+ request
+ (route/restricted (list-rolememberships-by-canvasser request)))
+ (GET
+ "/json/auto/list-rolememberships-by-role"
+ request
+ (route/restricted (list-rolememberships-by-role request)))
+ (GET
+ "/json/auto/list-roles"
+ request
+ (route/restricted (list-roles request)))
+ (GET
+ "/json/auto/list-roles-by-canvasser"
+ request
+ (route/restricted (list-roles-by-canvasser request)))
+ (GET
+ "/json/auto/list-teammemberships"
+ request
+ (route/restricted (list-teammemberships request)))
+ (GET
+ "/json/auto/list-teammemberships-by-canvasser"
+ request
+ (route/restricted (list-teammemberships-by-canvasser request)))
+ (GET
+ "/json/auto/list-teammemberships-by-team"
+ request
+ (route/restricted (list-teammemberships-by-team request)))
+ (GET
+ "/json/auto/list-teamorganiserships"
+ request
+ (route/restricted (list-teamorganiserships request)))
+ (GET
+ "/json/auto/list-teamorganiserships-by-canvasser"
+ request
+ (route/restricted (list-teamorganiserships-by-canvasser request)))
+ (GET
+ "/json/auto/list-teamorganiserships-by-team"
+ request
+ (route/restricted (list-teamorganiserships-by-team request)))
+ (GET
+ "/json/auto/list-teams"
+ request
+ (route/restricted (list-teams request)))
+ (GET
+ "/json/auto/list-teams-by-canvasser"
+ request
+ (route/restricted (list-teams-by-canvasser request)))
+ (GET
+ "/json/auto/list-teams-by-district"
+ request
+ (route/restricted (list-teams-by-district request)))
+ (GET
+ "/json/auto/list-visits"
+ request
+ (route/restricted (list-visits request)))
+ (GET
+ "/json/auto/list-visits-by-address"
+ request
+ (route/restricted (list-visits-by-address request)))
+ (GET
+ "/json/auto/list-visits-by-canvasser"
+ request
+ (route/restricted (list-visits-by-canvasser request)))
+ (GET
+ "/json/auto/search-strings-address"
+ request
+ (route/restricted (search-strings-address request)))
+ (GET
+ "/json/auto/search-strings-authority"
+ request
+ (route/restricted (search-strings-authority request)))
+ (GET
+ "/json/auto/search-strings-canvasser"
+ request
+ (route/restricted (search-strings-canvasser request)))
+ (GET
+ "/json/auto/search-strings-district"
+ request
+ (route/restricted (search-strings-district request)))
+ (GET
+ "/json/auto/search-strings-dwelling"
+ request
+ (route/restricted (search-strings-dwelling request)))
+ (GET
+ "/json/auto/search-strings-elector"
+ request
+ (route/restricted (search-strings-elector request)))
+ (GET
+ "/json/auto/search-strings-followupaction"
+ request
+ (route/restricted (search-strings-followupaction request)))
+ (GET
+ "/json/auto/search-strings-followupmethod"
+ request
+ (route/restricted (search-strings-followupmethod request)))
+ (GET
+ "/json/auto/search-strings-followuprequest"
+ request
+ (route/restricted (search-strings-followuprequest request)))
+ (GET
+ "/json/auto/search-strings-gender"
+ request
+ (route/restricted (search-strings-gender request)))
+ (GET
+ "/json/auto/search-strings-intention"
+ request
+ (route/restricted (search-strings-intention request)))
+ (GET
+ "/json/auto/search-strings-issue"
+ request
+ (route/restricted (search-strings-issue request)))
+ (GET
+ "/json/auto/search-strings-issueexpertise"
+ request
+ (route/restricted (search-strings-issueexpertise request)))
+ (GET
+ "/json/auto/search-strings-option"
+ request
+ (route/restricted (search-strings-option request)))
+ (GET
+ "/json/auto/search-strings-role"
+ request
+ (route/restricted (search-strings-role request)))
+ (GET
+ "/json/auto/search-strings-rolemembership"
+ request
+ (route/restricted (search-strings-rolemembership request)))
+ (GET
+ "/json/auto/search-strings-team"
+ request
+ (route/restricted (search-strings-team request)))
+ (GET
+ "/json/auto/search-strings-teammembership"
+ request
+ (route/restricted (search-strings-teammembership request)))
+ (GET
+ "/json/auto/search-strings-teamorganisership"
+ request
+ (route/restricted (search-strings-teamorganisership request)))
+ (GET
+ "/json/auto/search-strings-visit"
+ request
+ (route/restricted (search-strings-visit request)))
+ (POST
+ "/json/auto/update-address"
+ request
+ (route/restricted (update-address! request)))
+ (POST
+ "/json/auto/update-canvasser"
+ request
+ (route/restricted (update-canvasser! request)))
+ (POST
+ "/json/auto/update-district"
+ request
+ (route/restricted (update-district! request)))
+ (POST
+ "/json/auto/update-dwelling"
+ request
+ (route/restricted (update-dwelling! request)))
+ (POST
+ "/json/auto/update-elector"
+ request
+ (route/restricted (update-elector! request)))
+ (POST
+ "/json/auto/update-followupaction"
+ request
+ (route/restricted (update-followupaction! request)))
+ (POST
+ "/json/auto/update-followuprequest"
+ request
+ (route/restricted (update-followuprequest! request)))
+ (POST
+ "/json/auto/update-intention"
+ request
+ (route/restricted (update-intention! request)))
+ (POST
+ "/json/auto/update-issue"
+ request
+ (route/restricted (update-issue! request)))
+ (POST
+ "/json/auto/update-issueexpertise"
+ request
+ (route/restricted (update-issueexpertise! request)))
+ (POST
+ "/json/auto/update-role"
+ request
+ (route/restricted (update-role! request)))
+ (POST
+ "/json/auto/update-rolemembership"
+ request
+ (route/restricted (update-rolemembership! request)))
+ (POST
+ "/json/auto/update-team"
+ request
+ (route/restricted (update-team! request)))
+ (POST
+ "/json/auto/update-teammembership"
+ request
+ (route/restricted (update-teammembership! request)))
+ (POST
+ "/json/auto/update-teamorganisership"
+ request
+ (route/restricted (update-teamorganisership! request)))
+ (POST
+ "/json/auto/update-visit"
+ request
+ (route/restricted (update-visit! request))))
+
+
+(defn
+ create-address!
+ "Auto-generated method to insert one record to the `addresses` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-address! params)))
+
+(defn
+ create-authority!
+ "Auto-generated method to insert one record to the `authorities` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-authority! params)))
+
+(defn
+ create-canvasser!
+ "Auto-generated method to insert one record to the `canvassers` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-canvasser! params)))
+
+(defn
+ create-district!
+ "Auto-generated method to insert one record to the `districts` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-district! params)))
+
+(defn
+ create-dwelling!
+ "Auto-generated method to insert one record to the `dwellings` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-dwelling! params)))
+
+(defn
+ create-elector!
+ "Auto-generated method to insert one record to the `electors` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-elector! params)))
+
+(defn
+ create-followupaction!
+ "Auto-generated method to insert one record to the `followupactions` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followupaction! params)))
+
+(defn
+ create-followupmethod!
+ "Auto-generated method to insert one record to the `followupmethods` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followupmethod! params)))
+
+(defn
+ create-followuprequest!
+ "Auto-generated method to insert one record to the `followuprequests` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-followuprequest! params)))
+
+(defn
+ create-gender!
+ "Auto-generated method to insert one record to the `genders` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-gender! params)))
+
+(defn
+ create-intention!
+ "Auto-generated method to insert one record to the `intentions` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-intention! params)))
+
+(defn
+ create-issue!
+ "Auto-generated method to insert one record to the `issues` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-issue! params)))
+
+(defn
+ create-issueexpertise!
+ "Auto-generated method to insert one record to the `issueexpertise` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-issueexpertise! params)))
+
+(defn
+ create-option!
+ "Auto-generated method to insert one record to the `options` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-option! params)))
+
+(defn
+ create-role!
+ "Auto-generated method to insert one record to the `roles` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-role! params)))
+
+(defn
+ create-rolemembership!
+ "Auto-generated method to insert one record to the `rolememberships` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-rolemembership! params)))
+
+(defn
+ create-team!
+ "Auto-generated method to insert one record to the `teams` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-team! params)))
+
+(defn
+ create-teammembership!
+ "Auto-generated method to insert one record to the `teammemberships` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-teammembership! params)))
+
+(defn
+ create-teamorganisership!
+ "Auto-generated method to insert one record to the `teamorganiserships` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-teamorganisership! params)))
+
+(defn
+ create-visit!
+ "Auto-generated method to insert one record to the `visits` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the keys `nil` identifying the record created."
+ [{:keys [params]}]
+ (do (db/create-visit! params)))
+
+(defn
+ delete-address!
+ "Auto-generated method to delete one record from the `addresses` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-address! params))
+ (response/found "/"))
+
+(defn
+ delete-authority!
+ "Auto-generated method to delete one record from the `authorities` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-authority! params))
+ (response/found "/"))
+
+(defn
+ delete-canvasser!
+ "Auto-generated method to delete one record from the `canvassers` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-canvasser! params))
+ (response/found "/"))
+
+(defn
+ delete-district!
+ "Auto-generated method to delete one record from the `districts` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-district! params))
+ (response/found "/"))
+
+(defn
+ delete-dwelling!
+ "Auto-generated method to delete one record from the `dwellings` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-dwelling! params))
+ (response/found "/"))
+
+(defn
+ delete-elector!
+ "Auto-generated method to delete one record from the `electors` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-elector! params))
+ (response/found "/"))
+
+(defn
+ delete-followupaction!
+ "Auto-generated method to delete one record from the `followupactions` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-followupaction! params))
+ (response/found "/"))
+
+(defn
+ delete-followupmethod!
+ "Auto-generated method to delete one record from the `followupmethods` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-followupmethod! params))
+ (response/found "/"))
+
+(defn
+ delete-followuprequest!
+ "Auto-generated method to delete one record from the `followuprequests` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-followuprequest! params))
+ (response/found "/"))
+
+(defn
+ delete-gender!
+ "Auto-generated method to delete one record from the `genders` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-gender! params))
+ (response/found "/"))
+
+(defn
+ delete-intention!
+ "Auto-generated method to delete one record from the `intentions` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-intention! params))
+ (response/found "/"))
+
+(defn
+ delete-issue!
+ "Auto-generated method to delete one record from the `issues` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-issue! params))
+ (response/found "/"))
+
+(defn
+ delete-issueexpertise!
+ "Auto-generated method to delete one record from the `issueexpertise` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-issueexpertise! params))
+ (response/found "/"))
+
+(defn
+ delete-option!
+ "Auto-generated method to delete one record from the `options` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-option! params))
+ (response/found "/"))
+
+(defn
+ delete-role!
+ "Auto-generated method to delete one record from the `roles` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-role! params))
+ (response/found "/"))
+
+(defn
+ delete-rolemembership!
+ "Auto-generated method to delete one record from the `rolememberships` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-rolemembership! params))
+ (response/found "/"))
+
+(defn
+ delete-team!
+ "Auto-generated method to delete one record from the `teams` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-team! params))
+ (response/found "/"))
+
+(defn
+ delete-teammembership!
+ "Auto-generated method to delete one record from the `teammemberships` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-teammembership! params))
+ (response/found "/"))
+
+(defn
+ delete-teamorganisership!
+ "Auto-generated method to delete one record from the `teamorganiserships` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-teamorganisership! params))
+ (response/found "/"))
+
+(defn
+ delete-visit!
+ "Auto-generated method to delete one record from the `visits` table. Expects the following key(s) to be present in `params`: ``."
+ [{:keys [params]}]
+ (do (db/delete-visit! params))
+ (response/found "/"))
+
+(defn
+ get-address
+ "Auto-generated method to select one record from the `addresses` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-address params)))
+
+(defn
+ get-authority
+ "Auto-generated method to select one record from the `authorities` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-authority params)))
+
+(defn
+ get-canvasser
+ "Auto-generated method to select one record from the `canvassers` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-canvasser params)))
+
+(defn
+ get-canvasser-by-username
+ "Auto-generated method to select one record from the `canvassers` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-canvasser-by-username params)))
+
+(defn
+ get-district
+ "Auto-generated method to select one record from the `districts` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-district params)))
+
+(defn
+ get-dwelling
+ "Auto-generated method to select one record from the `dwellings` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-dwelling params)))
+
+(defn
+ get-elector
+ "Auto-generated method to select one record from the `electors` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-elector params)))
+
+(defn
+ get-followupaction
+ "Auto-generated method to select one record from the `followupactions` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-followupaction params)))
+
+(defn
+ get-followupmethod
+ "Auto-generated method to select one record from the `followupmethods` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-followupmethod params)))
+
+(defn
+ get-followuprequest
+ "Auto-generated method to select one record from the `followuprequests` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-followuprequest params)))
+
+(defn
+ get-gender
+ "Auto-generated method to select one record from the `genders` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-gender params)))
+
+(defn
+ get-intention
+ "Auto-generated method to select one record from the `intentions` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-intention params)))
+
+(defn
+ get-issue
+ "Auto-generated method to select one record from the `issues` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-issue params)))
+
+(defn
+ get-issueexpertise
+ "Auto-generated method to select one record from the `issueexpertise` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-issueexpertise params)))
+
+(defn
+ get-option
+ "Auto-generated method to select one record from the `options` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-option params)))
+
+(defn
+ get-role
+ "Auto-generated method to select one record from the `roles` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-role params)))
+
+(defn
+ get-rolemembership
+ "Auto-generated method to select one record from the `rolememberships` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-rolemembership params)))
+
+(defn
+ get-team
+ "Auto-generated method to select one record from the `teams` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-team params)))
+
+(defn
+ get-teammembership
+ "Auto-generated method to select one record from the `teammemberships` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-teammembership params)))
+
+(defn
+ get-teamorganisership
+ "Auto-generated method to select one record from the `teamorganiserships` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-teamorganisership params)))
+
+(defn
+ get-visit
+ "Auto-generated method to select one record from the `visits` table. Expects the following key(s) to be present in `params`: `nil`. Returns a map containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/get-visit params)))
+
+(defn
+ list-addresses
+ "Auto-generated method to select all records from the `addresses` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-addresses params)))
+
+(defn
+ list-addresses-by-district
+ [{:keys [params]}]
+ (do (db/list-addresses-by-district params)))
+
+(defn
+ list-authorities
+ "Auto-generated method to select all records from the `authorities` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-authorities params)))
+
+(defn
+ list-canvassers
+ "Auto-generated method to select all records from the `canvassers` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-canvassers params)))
+
+(defn
+ list-canvassers-by-address
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-address params)))
+
+(defn
+ list-canvassers-by-authority
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-authority params)))
+
+(defn
+ list-canvassers-by-elector
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-elector params)))
+
+(defn
+ list-canvassers-by-role
+ [{:keys [params]}]
+ (do (db/list-canvassers-by-role params)))
+
+(defn
+ list-districts
+ "Auto-generated method to select all records from the `districts` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-districts params)))
+
+(defn
+ list-dwellings
+ "Auto-generated method to select all records from the `dwellings` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-dwellings params)))
+
+(defn
+ list-dwellings-by-address
+ [{:keys [params]}]
+ (do (db/list-dwellings-by-address params)))
+
+(defn
+ list-electors
+ "Auto-generated method to select all records from the `electors` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-electors params)))
+
+(defn
+ list-electors-by-dwelling
+ [{:keys [params]}]
+ (do (db/list-electors-by-dwelling params)))
+
+(defn
+ list-electors-by-gender
+ [{:keys [params]}]
+ (do (db/list-electors-by-gender params)))
+
+(defn
+ list-followupactions
+ "Auto-generated method to select all records from the `followupactions` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-followupactions params)))
+
+(defn
+ list-followupactions-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-followupactions-by-canvasser params)))
+
+(defn
+ list-followupactions-by-followuprequest
+ [{:keys [params]}]
+ (do (db/list-followupactions-by-followuprequest params)))
+
+(defn
+ list-followupmethods
+ "Auto-generated method to select all records from the `followupmethods` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-followupmethods params)))
+
+(defn
+ list-followuprequests
+ "Auto-generated method to select all records from the `followuprequests` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-followuprequests params)))
+
+(defn
+ list-followuprequests-by-elector
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-elector params)))
+
+(defn
+ list-followuprequests-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-followupmethod params)))
+
+(defn
+ list-followuprequests-by-issue
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-issue params)))
+
+(defn
+ list-followuprequests-by-visit
+ [{:keys [params]}]
+ (do (db/list-followuprequests-by-visit params)))
+
+(defn
+ list-genders
+ "Auto-generated method to select all records from the `genders` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-genders params)))
+
+(defn
+ list-intentions
+ "Auto-generated method to select all records from the `intentions` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-intentions params)))
+
+(defn
+ list-intentions-by-elector
+ [{:keys [params]}]
+ (do (db/list-intentions-by-elector params)))
+
+(defn
+ list-intentions-by-option
+ [{:keys [params]}]
+ (do (db/list-intentions-by-option params)))
+
+(defn
+ list-intentions-by-visit
+ [{:keys [params]}]
+ (do (db/list-intentions-by-visit params)))
+
+(defn
+ list-issueexpertise
+ "Auto-generated method to select all records from the `issueexpertise` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-issueexpertise params)))
+
+(defn
+ list-issueexpertise-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-by-canvasser params)))
+
+(defn
+ list-issueexpertise-by-followupmethod
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-by-followupmethod params)))
+
+(defn
+ list-issueexpertise-by-issue
+ [{:keys [params]}]
+ (do (db/list-issueexpertise-by-issue params)))
+
+(defn
+ list-issues
+ "Auto-generated method to select all records from the `issues` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-issues params)))
+
+(defn
+ list-options
+ "Auto-generated method to select all records from the `options` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-options params)))
+
+(defn
+ list-rolememberships
+ "Auto-generated method to select all records from the `rolememberships` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-rolememberships params)))
+
+(defn
+ list-rolememberships-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-rolememberships-by-canvasser params)))
+
+(defn
+ list-rolememberships-by-role
+ [{:keys [params]}]
+ (do (db/list-rolememberships-by-role params)))
+
+(defn
+ list-roles
+ "Auto-generated method to select all records from the `roles` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-roles params)))
+
+(defn
+ list-roles-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-roles-by-canvasser params)))
+
+(defn
+ list-teammemberships
+ "Auto-generated method to select all records from the `teammemberships` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-teammemberships params)))
+
+(defn
+ list-teammemberships-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teammemberships-by-canvasser params)))
+
+(defn
+ list-teammemberships-by-team
+ [{:keys [params]}]
+ (do (db/list-teammemberships-by-team params)))
+
+(defn
+ list-teamorganiserships
+ "Auto-generated method to select all records from the `teamorganiserships` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships params)))
+
+(defn
+ list-teamorganiserships-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships-by-canvasser params)))
+
+(defn
+ list-teamorganiserships-by-team
+ [{:keys [params]}]
+ (do (db/list-teamorganiserships-by-team params)))
+
+(defn
+ list-teams
+ "Auto-generated method to select all records from the `teams` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-teams params)))
+
+(defn
+ list-teams-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-teams-by-canvasser params)))
+
+(defn
+ list-teams-by-district
+ [{:keys [params]}]
+ (do (db/list-teams-by-district params)))
+
+(defn
+ list-visits
+ "Auto-generated method to select all records from the `visits` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/list-visits params)))
+
+(defn
+ list-visits-by-address
+ [{:keys [params]}]
+ (do (db/list-visits-by-address params)))
+
+(defn
+ list-visits-by-canvasser
+ [{:keys [params]}]
+ (do (db/list-visits-by-canvasser params)))
+
+(defn
+ search-strings-address
+ "Auto-generated method to select all records from the `addresses` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-address params)))
+
+(defn
+ search-strings-authority
+ "Auto-generated method to select all records from the `authorities` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-authority params)))
+
+(defn
+ search-strings-canvasser
+ "Auto-generated method to select all records from the `canvassers` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-canvasser params)))
+
+(defn
+ search-strings-district
+ "Auto-generated method to select all records from the `districts` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-district params)))
+
+(defn
+ search-strings-dwelling
+ "Auto-generated method to select all records from the `dwellings` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-dwelling params)))
+
+(defn
+ search-strings-elector
+ "Auto-generated method to select all records from the `electors` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-elector params)))
+
+(defn
+ search-strings-followupaction
+ "Auto-generated method to select all records from the `followupactions` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-followupaction params)))
+
+(defn
+ search-strings-followupmethod
+ "Auto-generated method to select all records from the `followupmethods` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-followupmethod params)))
+
+(defn
+ search-strings-followuprequest
+ "Auto-generated method to select all records from the `followuprequests` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-followuprequest params)))
+
+(defn
+ search-strings-gender
+ "Auto-generated method to select all records from the `genders` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-gender params)))
+
+(defn
+ search-strings-intention
+ "Auto-generated method to select all records from the `intentions` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-intention params)))
+
+(defn
+ search-strings-issue
+ "Auto-generated method to select all records from the `issues` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-issue params)))
+
+(defn
+ search-strings-issueexpertise
+ "Auto-generated method to select all records from the `issueexpertise` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-issueexpertise params)))
+
+(defn
+ search-strings-option
+ "Auto-generated method to select all records from the `options` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-option params)))
+
+(defn
+ search-strings-role
+ "Auto-generated method to select all records from the `roles` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-role params)))
+
+(defn
+ search-strings-rolemembership
+ "Auto-generated method to select all records from the `rolememberships` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-rolemembership params)))
+
+(defn
+ search-strings-team
+ "Auto-generated method to select all records from the `teams` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-team params)))
+
+(defn
+ search-strings-teammembership
+ "Auto-generated method to select all records from the `teammemberships` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-teammembership params)))
+
+(defn
+ search-strings-teamorganisership
+ "Auto-generated method to select all records from the `teamorganiserships` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-teamorganisership params)))
+
+(defn
+ search-strings-visit
+ "Auto-generated method to select all records from the `visits` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(nil)`."
+ [{:keys [params]}]
+ (do (db/search-strings-visit params)))
+
+(defn
+ update-address!
+ "Auto-generated method to update one record in the `addresses` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-address! params))
+ (response/found "/"))
+
+(defn
+ update-canvasser!
+ "Auto-generated method to update one record in the `canvassers` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-canvasser! params))
+ (response/found "/"))
+
+(defn
+ update-district!
+ "Auto-generated method to update one record in the `districts` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-district! params))
+ (response/found "/"))
+
+(defn
+ update-dwelling!
+ "Auto-generated method to update one record in the `dwellings` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-dwelling! params))
+ (response/found "/"))
+
+(defn
+ update-elector!
+ "Auto-generated method to update one record in the `electors` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-elector! params))
+ (response/found "/"))
+
+(defn
+ update-followupaction!
+ "Auto-generated method to update one record in the `followupactions` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-followupaction! params))
+ (response/found "/"))
+
+(defn
+ update-followuprequest!
+ "Auto-generated method to update one record in the `followuprequests` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-followuprequest! params))
+ (response/found "/"))
+
+(defn
+ update-intention!
+ "Auto-generated method to update one record in the `intentions` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-intention! params))
+ (response/found "/"))
+
+(defn
+ update-issue!
+ "Auto-generated method to update one record in the `issues` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-issue! params))
+ (response/found "/"))
+
+(defn
+ update-issueexpertise!
+ "Auto-generated method to update one record in the `issueexpertise` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-issueexpertise! params))
+ (response/found "/"))
+
+(defn
+ update-role!
+ "Auto-generated method to update one record in the `roles` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-role! params))
+ (response/found "/"))
+
+(defn
+ update-rolemembership!
+ "Auto-generated method to update one record in the `rolememberships` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-rolemembership! params))
+ (response/found "/"))
+
+(defn
+ update-team!
+ "Auto-generated method to update one record in the `teams` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-team! params))
+ (response/found "/"))
+
+(defn
+ update-teammembership!
+ "Auto-generated method to update one record in the `teammemberships` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-teammembership! params))
+ (response/found "/"))
+
+(defn
+ update-teamorganisership!
+ "Auto-generated method to update one record in the `teamorganiserships` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-teamorganisership! params))
+ (response/found "/"))
+
+(defn
+ update-visit!
+ "Auto-generated method to update one record in the `visits` table. Expects the following key(s) to be present in `params`: `(nil)`."
+ [{:keys [params]}]
+ (do (db/update-visit! params))
+ (response/found "/"))
+
diff --git a/src/clj/youyesyet/routes/auto_json_routes.clj b/src/clj/youyesyet/routes/auto_json_routes.clj
deleted file mode 100644
index 64efb8f..0000000
--- a/src/clj/youyesyet/routes/auto_json_routes.clj
+++ /dev/null
@@ -1,1035 +0,0 @@
-(ns
- youyesyet.routes.auto-json-routes
- (require
- [noir.response :as nresponse]
- [noir.util.route :as route]
- [compojure.core :refer [defroutes GET POST]]
- [ring.util.http-response :as response]
- [clojure.java.io :as io]
- [hugsql.core :as hugsql]
- [youyesyet.db.core :as db]))
-
-
-(declare
- create-address
- create-authority
- create-canvasser
- create-district
- create-elector
- create-followupaction
- create-followupmethod
- create-followuprequest
- create-intention
- create-issue
- create-issueexpertise
- create-option
- create-role
- create-rolemembership
- create-schema-migration
- create-team
- create-teammembership
- create-teamorganisership
- create-visit
- delete-address
- delete-authority
- delete-canvasser
- delete-district
- delete-elector
- delete-followupaction
- delete-followupmethod
- delete-followuprequest
- delete-issue
- delete-option
- delete-visit
- get-address
- get-authority
- get-canvasser
- get-district
- get-elector
- get-followupaction
- get-followupmethod
- get-followuprequest
- get-issue
- get-option
- get-visit
- list-addresses
- list-addresses-by-district
- list-authorities
- list-canvassers
- list-canvassers-by-address
- list-canvassers-by-authoritie
- list-canvassers-by-elector
- list-districts
- list-electors
- list-electors-by-address
- list-followupactions
- list-followupactions-by-canvasser
- list-followupactions-by-followuprequest
- list-followupmethods
- list-followuprequests
- list-followuprequests-by-elector
- list-followuprequests-by-followupmethod
- list-followuprequests-by-issue
- list-followuprequests-by-visit
- list-intentions-electors-by-option
- list-intentions-electors-by-visit
- list-intentions-options-by-elector
- list-intentions-options-by-visit
- list-intentions-visits-by-elector
- list-intentions-visits-by-option
- list-issueexpertise-canvassers-by-followupmethod
- list-issueexpertise-canvassers-by-issue
- list-issueexpertise-followupmethods-by-canvasser
- list-issueexpertise-followupmethods-by-issue
- list-issueexpertise-issues-by-canvasser
- list-issueexpertise-issues-by-followupmethod
- list-issues
- list-options
- list-rolememberships-canvassers-by-role
- list-rolememberships-roles-by-canvasser
- list-roles
- list-schemamigrations
- list-teammemberships-canvassers-by-team
- list-teammemberships-teams-by-canvasser
- list-teamorganiserships-canvassers-by-team
- list-teamorganiserships-teams-by-canvasser
- list-teams
- list-teams-by-district
- list-visits
- list-visits-by-address
- list-visits-by-canvasser
- update-address
- update-canvasser
- update-district
- update-elector
- update-followupaction
- update-followuprequest
- update-issue
- update-visit)
-
-
-(defroutes
- auto-rest-routes
- (POST "/json/auto/create-address" request (create-address request))
- (POST
- "/json/auto/create-authority"
- request
- (create-authority request))
- (POST
- "/json/auto/create-canvasser"
- request
- (create-canvasser request))
- (POST "/json/auto/create-district" request (create-district request))
- (POST "/json/auto/create-elector" request (create-elector request))
- (POST
- "/json/auto/create-followupaction"
- request
- (create-followupaction request))
- (POST
- "/json/auto/create-followupmethod"
- request
- (create-followupmethod request))
- (POST
- "/json/auto/create-followuprequest"
- request
- (create-followuprequest request))
- (POST
- "/json/auto/create-intention"
- request
- (create-intention request))
- (POST "/json/auto/create-issue" request (create-issue request))
- (POST
- "/json/auto/create-issueexpertise"
- request
- (create-issueexpertise request))
- (POST "/json/auto/create-option" request (create-option request))
- (POST "/json/auto/create-role" request (create-role request))
- (POST
- "/json/auto/create-rolemembership"
- request
- (create-rolemembership request))
- (POST
- "/json/auto/create-schema-migration"
- request
- (create-schema-migration request))
- (POST "/json/auto/create-team" request (create-team request))
- (POST
- "/json/auto/create-teammembership"
- request
- (create-teammembership request))
- (POST
- "/json/auto/create-teamorganisership"
- request
- (create-teamorganisership request))
- (POST "/json/auto/create-visit" request (create-visit request))
- (POST "/json/auto/delete-address" request (delete-address request))
- (POST
- "/json/auto/delete-authority"
- request
- (delete-authority request))
- (POST
- "/json/auto/delete-canvasser"
- request
- (delete-canvasser request))
- (POST "/json/auto/delete-district" request (delete-district request))
- (POST "/json/auto/delete-elector" request (delete-elector request))
- (POST
- "/json/auto/delete-followupaction"
- request
- (delete-followupaction request))
- (POST
- "/json/auto/delete-followupmethod"
- request
- (delete-followupmethod request))
- (POST
- "/json/auto/delete-followuprequest"
- request
- (delete-followuprequest request))
- (POST "/json/auto/delete-issue" request (delete-issue request))
- (POST "/json/auto/delete-option" request (delete-option request))
- (POST "/json/auto/delete-visit" request (delete-visit request))
- (POST "/json/auto/get-address" request (get-address request))
- (POST "/json/auto/get-authority" request (get-authority request))
- (POST "/json/auto/get-canvasser" request (get-canvasser request))
- (POST "/json/auto/get-district" request (get-district request))
- (POST "/json/auto/get-elector" request (get-elector request))
- (POST
- "/json/auto/get-followupaction"
- request
- (get-followupaction request))
- (POST
- "/json/auto/get-followupmethod"
- request
- (get-followupmethod request))
- (POST
- "/json/auto/get-followuprequest"
- request
- (get-followuprequest request))
- (POST "/json/auto/get-issue" request (get-issue request))
- (POST "/json/auto/get-option" request (get-option request))
- (POST "/json/auto/get-visit" request (get-visit request))
- (GET "/json/auto/list-addresses" request (list-addresses request))
- (GET
- "/json/auto/list-addresses-by-district"
- request
- (list-addresses-by-district request))
- (GET "/json/auto/list-authorities" request (list-authorities request))
- (GET "/json/auto/list-canvassers" request (list-canvassers request))
- (GET
- "/json/auto/list-canvassers-by-address"
- request
- (list-canvassers-by-address request))
- (GET
- "/json/auto/list-canvassers-by-authoritie"
- request
- (list-canvassers-by-authoritie request))
- (GET
- "/json/auto/list-canvassers-by-elector"
- request
- (list-canvassers-by-elector request))
- (GET "/json/auto/list-districts" request (list-districts request))
- (GET "/json/auto/list-electors" request (list-electors request))
- (GET
- "/json/auto/list-electors-by-address"
- request
- (list-electors-by-address request))
- (GET
- "/json/auto/list-followupactions"
- request
- (list-followupactions request))
- (GET
- "/json/auto/list-followupactions-by-canvasser"
- request
- (list-followupactions-by-canvasser request))
- (GET
- "/json/auto/list-followupactions-by-followuprequest"
- request
- (list-followupactions-by-followuprequest request))
- (GET
- "/json/auto/list-followupmethods"
- request
- (list-followupmethods request))
- (GET
- "/json/auto/list-followuprequests"
- request
- (list-followuprequests request))
- (GET
- "/json/auto/list-followuprequests-by-elector"
- request
- (list-followuprequests-by-elector request))
- (GET
- "/json/auto/list-followuprequests-by-followupmethod"
- request
- (list-followuprequests-by-followupmethod request))
- (GET
- "/json/auto/list-followuprequests-by-issue"
- request
- (list-followuprequests-by-issue request))
- (GET
- "/json/auto/list-followuprequests-by-visit"
- request
- (list-followuprequests-by-visit request))
- (GET
- "/json/auto/list-intentions-electors-by-option"
- request
- (list-intentions-electors-by-option request))
- (GET
- "/json/auto/list-intentions-electors-by-visit"
- request
- (list-intentions-electors-by-visit request))
- (GET
- "/json/auto/list-intentions-options-by-elector"
- request
- (list-intentions-options-by-elector request))
- (GET
- "/json/auto/list-intentions-options-by-visit"
- request
- (list-intentions-options-by-visit request))
- (GET
- "/json/auto/list-intentions-visits-by-elector"
- request
- (list-intentions-visits-by-elector request))
- (GET
- "/json/auto/list-intentions-visits-by-option"
- request
- (list-intentions-visits-by-option request))
- (GET
- "/json/auto/list-issueexpertise-canvassers-by-followupmethod"
- request
- (list-issueexpertise-canvassers-by-followupmethod request))
- (GET
- "/json/auto/list-issueexpertise-canvassers-by-issue"
- request
- (list-issueexpertise-canvassers-by-issue request))
- (GET
- "/json/auto/list-issueexpertise-followupmethods-by-canvasser"
- request
- (list-issueexpertise-followupmethods-by-canvasser request))
- (GET
- "/json/auto/list-issueexpertise-followupmethods-by-issue"
- request
- (list-issueexpertise-followupmethods-by-issue request))
- (GET
- "/json/auto/list-issueexpertise-issues-by-canvasser"
- request
- (list-issueexpertise-issues-by-canvasser request))
- (GET
- "/json/auto/list-issueexpertise-issues-by-followupmethod"
- request
- (list-issueexpertise-issues-by-followupmethod request))
- (GET "/json/auto/list-issues" request (list-issues request))
- (GET "/json/auto/list-options" request (list-options request))
- (GET
- "/json/auto/list-rolememberships-canvassers-by-role"
- request
- (list-rolememberships-canvassers-by-role request))
- (GET
- "/json/auto/list-rolememberships-roles-by-canvasser"
- request
- (list-rolememberships-roles-by-canvasser request))
- (GET "/json/auto/list-roles" request (list-roles request))
- (GET
- "/json/auto/list-schemamigrations"
- request
- (list-schemamigrations request))
- (GET
- "/json/auto/list-teammemberships-canvassers-by-team"
- request
- (list-teammemberships-canvassers-by-team request))
- (GET
- "/json/auto/list-teammemberships-teams-by-canvasser"
- request
- (list-teammemberships-teams-by-canvasser request))
- (GET
- "/json/auto/list-teamorganiserships-canvassers-by-team"
- request
- (list-teamorganiserships-canvassers-by-team request))
- (GET
- "/json/auto/list-teamorganiserships-teams-by-canvasser"
- request
- (list-teamorganiserships-teams-by-canvasser request))
- (GET "/json/auto/list-teams" request (list-teams request))
- (GET
- "/json/auto/list-teams-by-district"
- request
- (list-teams-by-district request))
- (GET "/json/auto/list-visits" request (list-visits request))
- (GET
- "/json/auto/list-visits-by-address"
- request
- (list-visits-by-address request))
- (GET
- "/json/auto/list-visits-by-canvasser"
- request
- (list-visits-by-canvasser request))
- (POST "/json/auto/update-address" request (update-address request))
- (POST
- "/json/auto/update-canvasser"
- request
- (update-canvasser request))
- (POST "/json/auto/update-district" request (update-district request))
- (POST "/json/auto/update-elector" request (update-elector request))
- (POST
- "/json/auto/update-followupaction"
- request
- (update-followupaction request))
- (POST
- "/json/auto/update-followuprequest"
- request
- (update-followuprequest request))
- (POST "/json/auto/update-issue" request (update-issue request))
- (POST "/json/auto/update-visit" request (update-visit request)))
-
-
-(defn
- create-address
- "Auto-generated method to insert one record to the addresses table. Expects the following key(s) to be present in `params`: (:id :address :postcode :phone :district_id :latitude :longitude). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-address! params)))
-
-
-(defn
- create-authority
- "Auto-generated method to insert one record to the authorities table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-authority! params)))
-
-
-(defn
- create-canvasser
- "Auto-generated method to insert one record to the canvassers table. Expects the following key(s) to be present in `params`: (:id :username :fullname :elector_id :address_id :phone :email :authority_id :authorised). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-canvasser! params)))
-
-
-(defn
- create-district
- "Auto-generated method to insert one record to the districts table. Expects the following key(s) to be present in `params`: (:id :name). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-district! params)))
-
-
-(defn
- create-elector
- "Auto-generated method to insert one record to the electors table. Expects the following key(s) to be present in `params`: (:id :name :address_id :phone :email). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-elector! params)))
-
-
-(defn
- create-followupaction
- "Auto-generated method to insert one record to the followupactions table. Expects the following key(s) to be present in `params`: (:id :request_id :actor :date :notes :closed). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-followupaction! params)))
-
-
-(defn
- create-followupmethod
- "Auto-generated method to insert one record to the followupmethods table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-followupmethod! params)))
-
-
-(defn
- create-followuprequest
- "Auto-generated method to insert one record to the followuprequests table. Expects the following key(s) to be present in `params`: (:id :elector_id :visit_id :issue_id :method_id). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-followuprequest! params)))
-
-
-(defn
- create-intention
- "Auto-generated method to insert one record to the intentions table. Expects the following key(s) to be present in `params`: (:visit_id :elector_id :option_id). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-intention! params)))
-
-
-(defn
- create-issue
- "Auto-generated method to insert one record to the issues table. Expects the following key(s) to be present in `params`: (:id :url). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-issue! params)))
-
-
-(defn
- create-issueexpertise
- "Auto-generated method to insert one record to the issueexpertise table. Expects the following key(s) to be present in `params`: (:canvasser_id :issue_id :method_id). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-issueexpertise! params)))
-
-
-(defn
- create-option
- "Auto-generated method to insert one record to the options table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-option! params)))
-
-
-(defn
- create-role
- "Auto-generated method to insert one record to the roles table. Expects the following key(s) to be present in `params`: (:id :name). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-role! params)))
-
-
-(defn
- create-rolemembership
- "Auto-generated method to insert one record to the rolememberships table. Expects the following key(s) to be present in `params`: (:role_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-rolemembership! params)))
-
-
-(defn
- create-schema-migration
- "Auto-generated method to insert one record to the schema_migrations table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-schema-migration! params)))
-
-
-(defn
- create-team
- "Auto-generated method to insert one record to the teams table. Expects the following key(s) to be present in `params`: (:id :name :district_id :latitude :longitude). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-team! params)))
-
-
-(defn
- create-teammembership
- "Auto-generated method to insert one record to the teammemberships table. Expects the following key(s) to be present in `params`: (:team_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-teammembership! params)))
-
-
-(defn
- create-teamorganisership
- "Auto-generated method to insert one record to the teamorganiserships table. Expects the following key(s) to be present in `params`: (:team_id :canvasser_id). Returns a map containing the keys nil identifying the record created."
- [{:keys [params]}]
- (do (db/create-teamorganisership! params)))
-
-
-(defn
- create-visit
- "Auto-generated method to insert one record to the visits table. Expects the following key(s) to be present in `params`: (:id :address_id :canvasser_id :date). Returns a map containing the keys (:id) identifying the record created."
- [{:keys [params]}]
- (do (db/create-visit! params)))
-
-
-(defn
- delete-address
- "Auto-generated method to delete one record from the addresses table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-address! params))
- (response/found "/"))
-
-
-(defn
- delete-authority
- "Auto-generated method to delete one record from the authorities table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-authority! params))
- (response/found "/"))
-
-
-(defn
- delete-canvasser
- "Auto-generated method to delete one record from the canvassers table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-canvasser! params))
- (response/found "/"))
-
-
-(defn
- delete-district
- "Auto-generated method to delete one record from the districts table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-district! params))
- (response/found "/"))
-
-
-(defn
- delete-elector
- "Auto-generated method to delete one record from the electors table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-elector! params))
- (response/found "/"))
-
-
-(defn
- delete-followupaction
- "Auto-generated method to delete one record from the followupactions table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-followupaction! params))
- (response/found "/"))
-
-
-(defn
- delete-followupmethod
- "Auto-generated method to delete one record from the followupmethods table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-followupmethod! params))
- (response/found "/"))
-
-
-(defn
- delete-followuprequest
- "Auto-generated method to delete one record from the followuprequests table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-followuprequest! params))
- (response/found "/"))
-
-
-(defn
- delete-issue
- "Auto-generated method to delete one record from the issues table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-issue! params))
- (response/found "/"))
-
-
-(defn
- delete-option
- "Auto-generated method to delete one record from the options table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-option! params))
- (response/found "/"))
-
-
-(defn
- delete-visit
- "Auto-generated method to delete one record from the visits table. Expects the following key(s) to be present in `params`: (:id)."
- [{:keys [params]}]
- (do (db/delete-visit! params))
- (response/found "/"))
-
-
-(defn
- get-address
- "Auto-generated method to select one record from the addresses table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address :district_id :id :latitude :longitude :phone :postcode)."
- [{:keys [params]}]
- (do (db/get-address params)))
-
-
-(defn
- get-authority
- "Auto-generated method to select one record from the authorities table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/get-authority params)))
-
-
-(defn
- get-canvasser
- "Auto-generated method to select one record from the canvassers table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
- [{:keys [params]}]
- (do (db/get-canvasser params)))
-
-
-(defn
- get-district
- "Auto-generated method to select one record from the districts table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id :name)."
- [{:keys [params]}]
- (do (db/get-district params)))
-
-
-(defn
- get-elector
- "Auto-generated method to select one record from the electors table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :email :id :name :phone)."
- [{:keys [params]}]
- (do (db/get-elector params)))
-
-
-(defn
- get-followupaction
- "Auto-generated method to select one record from the followupactions table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:actor :closed :date :id :notes :request_id)."
- [{:keys [params]}]
- (do (db/get-followupaction params)))
-
-
-(defn
- get-followupmethod
- "Auto-generated method to select one record from the followupmethods table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/get-followupmethod params)))
-
-
-(defn
- get-followuprequest
- "Auto-generated method to select one record from the followuprequests table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:elector_id :id :issue_id :method_id :visit_id)."
- [{:keys [params]}]
- (do (db/get-followuprequest params)))
-
-
-(defn
- get-issue
- "Auto-generated method to select one record from the issues table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id :url)."
- [{:keys [params]}]
- (do (db/get-issue params)))
-
-
-(defn
- get-option
- "Auto-generated method to select one record from the options table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/get-option params)))
-
-
-(defn
- get-visit
- "Auto-generated method to select one record from the visits table. Expects the following key(s) to be present in `params`: (:id). Returns a map containing the following keys: (:address_id :canvasser_id :date :id)."
- [{:keys [params]}]
- (do (db/get-visit params)))
-
-
-(defn
- list-addresses
- "Auto-generated method to select all records from the addresses table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address :district_id :id :latitude :longitude :phone :postcode)."
- [{:keys [params]}]
- (do (db/list-addresses params)))
-
-
-(defn
- list-addresses-by-district
- [{:keys [params]}]
- (do (db/list-addresses-by-district params)))
-
-
-(defn
- list-authorities
- "Auto-generated method to select all records from the authorities table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/list-authorities params)))
-
-
-(defn
- list-canvassers
- "Auto-generated method to select all records from the canvassers table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
- [{:keys [params]}]
- (do (db/list-canvassers params)))
-
-
-(defn
- list-canvassers-by-address
- [{:keys [params]}]
- (do (db/list-canvassers-by-address params)))
-
-
-(defn
- list-canvassers-by-authoritie
- [{:keys [params]}]
- (do (db/list-canvassers-by-authoritie params)))
-
-
-(defn
- list-canvassers-by-elector
- [{:keys [params]}]
- (do (db/list-canvassers-by-elector params)))
-
-
-(defn
- list-districts
- "Auto-generated method to select all records from the districts table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :name)."
- [{:keys [params]}]
- (do (db/list-districts params)))
-
-
-(defn
- list-electors
- "Auto-generated method to select all records from the electors table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :email :id :name :phone)."
- [{:keys [params]}]
- (do (db/list-electors params)))
-
-
-(defn
- list-electors-by-address
- [{:keys [params]}]
- (do (db/list-electors-by-address params)))
-
-
-(defn
- list-followupactions
- "Auto-generated method to select all records from the followupactions table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:actor :closed :date :id :notes :request_id)."
- [{:keys [params]}]
- (do (db/list-followupactions params)))
-
-
-(defn
- list-followupactions-by-canvasser
- [{:keys [params]}]
- (do (db/list-followupactions-by-canvasser params)))
-
-
-(defn
- list-followupactions-by-followuprequest
- [{:keys [params]}]
- (do (db/list-followupactions-by-followuprequest params)))
-
-
-(defn
- list-followupmethods
- "Auto-generated method to select all records from the followupmethods table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/list-followupmethods params)))
-
-
-(defn
- list-followuprequests
- "Auto-generated method to select all records from the followuprequests table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:elector_id :id :issue_id :method_id :visit_id)."
- [{:keys [params]}]
- (do (db/list-followuprequests params)))
-
-
-(defn
- list-followuprequests-by-elector
- [{:keys [params]}]
- (do (db/list-followuprequests-by-elector params)))
-
-
-(defn
- list-followuprequests-by-followupmethod
- [{:keys [params]}]
- (do (db/list-followuprequests-by-followupmethod params)))
-
-
-(defn
- list-followuprequests-by-issue
- [{:keys [params]}]
- (do (db/list-followuprequests-by-issue params)))
-
-
-(defn
- list-followuprequests-by-visit
- [{:keys [params]}]
- (do (db/list-followuprequests-by-visit params)))
-
-
-(defn
- list-intentions-electors-by-option
- [{:keys [params]}]
- (do (db/list-intentions-electors-by-option params)))
-
-
-(defn
- list-intentions-electors-by-visit
- [{:keys [params]}]
- (do (db/list-intentions-electors-by-visit params)))
-
-
-(defn
- list-intentions-options-by-elector
- [{:keys [params]}]
- (do (db/list-intentions-options-by-elector params)))
-
-
-(defn
- list-intentions-options-by-visit
- [{:keys [params]}]
- (do (db/list-intentions-options-by-visit params)))
-
-
-(defn
- list-intentions-visits-by-elector
- [{:keys [params]}]
- (do (db/list-intentions-visits-by-elector params)))
-
-
-(defn
- list-intentions-visits-by-option
- [{:keys [params]}]
- (do (db/list-intentions-visits-by-option params)))
-
-
-(defn
- list-issueexpertise-canvassers-by-followupmethod
- [{:keys [params]}]
- (do (db/list-issueexpertise-canvassers-by-followupmethod params)))
-
-
-(defn
- list-issueexpertise-canvassers-by-issue
- [{:keys [params]}]
- (do (db/list-issueexpertise-canvassers-by-issue params)))
-
-
-(defn
- list-issueexpertise-followupmethods-by-canvasser
- [{:keys [params]}]
- (do (db/list-issueexpertise-followupmethods-by-canvasser params)))
-
-
-(defn
- list-issueexpertise-followupmethods-by-issue
- [{:keys [params]}]
- (do (db/list-issueexpertise-followupmethods-by-issue params)))
-
-
-(defn
- list-issueexpertise-issues-by-canvasser
- [{:keys [params]}]
- (do (db/list-issueexpertise-issues-by-canvasser params)))
-
-
-(defn
- list-issueexpertise-issues-by-followupmethod
- [{:keys [params]}]
- (do (db/list-issueexpertise-issues-by-followupmethod params)))
-
-
-(defn
- list-issues
- "Auto-generated method to select all records from the issues table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :url)."
- [{:keys [params]}]
- (do (db/list-issues params)))
-
-
-(defn
- list-options
- "Auto-generated method to select all records from the options table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/list-options params)))
-
-
-(defn
- list-rolememberships-canvassers-by-role
- [{:keys [params]}]
- (do (db/list-rolememberships-canvassers-by-role params)))
-
-
-(defn
- list-rolememberships-roles-by-canvasser
- [{:keys [params]}]
- (do (db/list-rolememberships-roles-by-canvasser params)))
-
-
-(defn
- list-roles
- "Auto-generated method to select all records from the roles table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id :name)."
- [{:keys [params]}]
- (do (db/list-roles params)))
-
-
-(defn
- list-schemamigrations
- "Auto-generated method to select all records from the schema_migrations table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:id)."
- [{:keys [params]}]
- (do (db/list-schema_migrations params)))
-
-
-(defn
- list-teammemberships-canvassers-by-team
- [{:keys [params]}]
- (do (db/list-teammemberships-canvassers-by-team params)))
-
-
-(defn
- list-teammemberships-teams-by-canvasser
- [{:keys [params]}]
- (do (db/list-teammemberships-teams-by-canvasser params)))
-
-
-(defn
- list-teamorganiserships-canvassers-by-team
- [{:keys [params]}]
- (do (db/list-teamorganiserships-canvassers-by-team params)))
-
-
-(defn
- list-teamorganiserships-teams-by-canvasser
- [{:keys [params]}]
- (do (db/list-teamorganiserships-teams-by-canvasser params)))
-
-
-(defn
- list-teams
- "Auto-generated method to select all records from the teams table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:district_id :id :latitude :longitude :name)."
- [{:keys [params]}]
- (do (db/list-teams params)))
-
-
-(defn
- list-teams-by-district
- [{:keys [params]}]
- (do (db/list-teams-by-district params)))
-
-
-(defn
- list-visits
- "Auto-generated method to select all records from the visits table. If the keys (:limit :offset) are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: (:address_id :canvasser_id :date :id)."
- [{:keys [params]}]
- (do (db/list-visits params)))
-
-
-(defn
- list-visits-by-address
- [{:keys [params]}]
- (do (db/list-visits-by-address params)))
-
-
-(defn
- list-visits-by-canvasser
- [{:keys [params]}]
- (do (db/list-visits-by-canvasser params)))
-
-
-(defn
- update-address
- "Auto-generated method to update one record in the addresses table. Expects the following key(s) to be present in `params`: (:address :district_id :id :latitude :longitude :phone :postcode)."
- [{:keys [params]}]
- (do (db/update-address! params))
- (response/found "/"))
-
-
-(defn
- update-canvasser
- "Auto-generated method to update one record in the canvassers table. Expects the following key(s) to be present in `params`: (:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)."
- [{:keys [params]}]
- (do (db/update-canvasser! params))
- (response/found "/"))
-
-
-(defn
- update-district
- "Auto-generated method to update one record in the districts table. Expects the following key(s) to be present in `params`: (:id :name)."
- [{:keys [params]}]
- (do (db/update-district! params))
- (response/found "/"))
-
-
-(defn
- update-elector
- "Auto-generated method to update one record in the electors table. Expects the following key(s) to be present in `params`: (:address_id :email :id :name :phone)."
- [{:keys [params]}]
- (do (db/update-elector! params))
- (response/found "/"))
-
-
-(defn
- update-followupaction
- "Auto-generated method to update one record in the followupactions table. Expects the following key(s) to be present in `params`: (:actor :closed :date :id :notes :request_id)."
- [{:keys [params]}]
- (do (db/update-followupaction! params))
- (response/found "/"))
-
-
-(defn
- update-followuprequest
- "Auto-generated method to update one record in the followuprequests table. Expects the following key(s) to be present in `params`: (:elector_id :id :issue_id :method_id :visit_id)."
- [{:keys [params]}]
- (do (db/update-followuprequest! params))
- (response/found "/"))
-
-
-(defn
- update-issue
- "Auto-generated method to update one record in the issues table. Expects the following key(s) to be present in `params`: (:id :url)."
- [{:keys [params]}]
- (do (db/update-issue! params))
- (response/found "/"))
-
-
-(defn
- update-visit
- "Auto-generated method to update one record in the visits table. Expects the following key(s) to be present in `params`: (:address_id :canvasser_id :date :id)."
- [{:keys [params]}]
- (do (db/update-visit! params))
- (response/found "/"))
-
-
diff --git a/src/clj/youyesyet/routes/manual.clj b/src/clj/youyesyet/routes/manual.clj
index 1da2e3e..bf3cf46 100644
--- a/src/clj/youyesyet/routes/manual.clj
+++ b/src/clj/youyesyet/routes/manual.clj
@@ -1,5 +1,5 @@
(ns
- youyesyet.routes.auto
+ youyesyet.routes.manual
"Manual overrides for auto-generated routes"
(:require
[noir.response :as nresponse]
diff --git a/youyesyet.adl.xml b/youyesyet.adl.xml
index de657b5..52a6aef 100644
--- a/youyesyet.adl.xml
+++ b/youyesyet.adl.xml
@@ -323,6 +323,9 @@
+
+
+
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
index 8fb571f..62a75e9 100644
--- a/youyesyet.canonical.adl.xml
+++ b/youyesyet.canonical.adl.xml
@@ -414,8 +414,11 @@
+
+
+
-
+
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -220,49 +220,49 @@ Followupmethod
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html
index 3fbf3ab..30af8fe 100644
--- a/resources/templates/auto/form-addresses-Address.html
+++ b/resources/templates/auto/form-addresses-Address.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -248,49 +248,49 @@ To delete this addresses record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-canvassers-Canvasser.html b/resources/templates/auto/form-canvassers-Canvasser.html
index 8a975b9..2df601e 100644
--- a/resources/templates/auto/form-canvassers-Canvasser.html
+++ b/resources/templates/auto/form-canvassers-Canvasser.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -343,49 +343,49 @@ To delete this canvassers record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-districts-District.html b/resources/templates/auto/form-districts-District.html
index 6755daa..108288b 100644
--- a/resources/templates/auto/form-districts-District.html
+++ b/resources/templates/auto/form-districts-District.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -98,49 +98,49 @@ To delete this districts record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-dwellings-Dwelling.html b/resources/templates/auto/form-dwellings-Dwelling.html
index ab82225..15462c1 100644
--- a/resources/templates/auto/form-dwellings-Dwelling.html
+++ b/resources/templates/auto/form-dwellings-Dwelling.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -136,49 +136,49 @@ To delete this dwellings record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-electors-Elector.html b/resources/templates/auto/form-electors-Elector.html
index 099cd53..c696650 100644
--- a/resources/templates/auto/form-electors-Elector.html
+++ b/resources/templates/auto/form-electors-Elector.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -228,49 +228,49 @@ To delete this electors record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-followupactions-Followupaction.html b/resources/templates/auto/form-followupactions-Followupaction.html
index a82cce8..b7b3e1d 100644
--- a/resources/templates/auto/form-followupactions-Followupaction.html
+++ b/resources/templates/auto/form-followupactions-Followupaction.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -230,49 +230,49 @@ To delete this followupactions record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-issues-Issue.html b/resources/templates/auto/form-issues-Issue.html
index 1a33953..c496dcd 100644
--- a/resources/templates/auto/form-issues-Issue.html
+++ b/resources/templates/auto/form-issues-Issue.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -139,49 +139,49 @@ To delete this issues record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-roles-Role.html b/resources/templates/auto/form-roles-Role.html
index 1d20938..2215d29 100644
--- a/resources/templates/auto/form-roles-Role.html
+++ b/resources/templates/auto/form-roles-Role.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -117,49 +117,49 @@ To delete this roles record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-teams-Team.html b/resources/templates/auto/form-teams-Team.html
index e08105f..17a7abf 100644
--- a/resources/templates/auto/form-teams-Team.html
+++ b/resources/templates/auto/form-teams-Team.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -211,49 +211,49 @@ To delete this teams record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/form-visits-Visit.html b/resources/templates/auto/form-visits-Visit.html
index 2c1ea30..eea048a 100644
--- a/resources/templates/auto/form-visits-Visit.html
+++ b/resources/templates/auto/form-visits-Visit.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -174,49 +174,49 @@ To delete this visits record
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-addresses-Addresses.html b/resources/templates/auto/list-addresses-Addresses.html
index 70aa63e..67f54be 100644
--- a/resources/templates/auto/list-addresses-Addresses.html
+++ b/resources/templates/auto/list-addresses-Addresses.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -124,49 +124,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-canvassers-Canvassers.html b/resources/templates/auto/list-canvassers-Canvassers.html
index 98c8b4a..3208f2c 100644
--- a/resources/templates/auto/list-canvassers-Canvassers.html
+++ b/resources/templates/auto/list-canvassers-Canvassers.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -142,49 +142,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-districts-Districts.html b/resources/templates/auto/list-districts-Districts.html
index 3349092..f7ba9a6 100644
--- a/resources/templates/auto/list-districts-Districts.html
+++ b/resources/templates/auto/list-districts-Districts.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -79,49 +79,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-dwellings-Dwellings.html b/resources/templates/auto/list-dwellings-Dwellings.html
index 7f39626..308fa23 100644
--- a/resources/templates/auto/list-dwellings-Dwellings.html
+++ b/resources/templates/auto/list-dwellings-Dwellings.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -88,49 +88,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-electors-Electors.html b/resources/templates/auto/list-electors-Electors.html
index da7d082..0a512bf 100644
--- a/resources/templates/auto/list-electors-Electors.html
+++ b/resources/templates/auto/list-electors-Electors.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -115,49 +115,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-followupactions-Followupactions.html b/resources/templates/auto/list-followupactions-Followupactions.html
index 6c587e6..bd336e9 100644
--- a/resources/templates/auto/list-followupactions-Followupactions.html
+++ b/resources/templates/auto/list-followupactions-Followupactions.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -115,49 +115,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-issues-Issues.html b/resources/templates/auto/list-issues-Issues.html
index d1c9e43..3eb2726 100644
--- a/resources/templates/auto/list-issues-Issues.html
+++ b/resources/templates/auto/list-issues-Issues.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -88,49 +88,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-roles-Roles.html b/resources/templates/auto/list-roles-Roles.html
index 720443f..6fe67e3 100644
--- a/resources/templates/auto/list-roles-Roles.html
+++ b/resources/templates/auto/list-roles-Roles.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -79,49 +79,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-teams-Teams.html b/resources/templates/auto/list-teams-Teams.html
index d3b6c19..c456013 100644
--- a/resources/templates/auto/list-teams-Teams.html
+++ b/resources/templates/auto/list-teams-Teams.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -106,49 +106,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/auto/list-visits-Visits.html b/resources/templates/auto/list-visits-Visits.html
index fd26cb1..0eed2f0 100644
--- a/resources/templates/auto/list-visits-Visits.html
+++ b/resources/templates/auto/list-visits-Visits.html
@@ -1,22 +1,22 @@
{% extends "base.html" %}
-
{% block head %}
-
+
-
+
-
+
-
+
-
+
-
+
-
+
{{site-title}}: {{title}}
-
+
{% endblock %}
@@ -97,49 +97,49 @@ View
{% endblock %}
{% block foot %}
-
-
-
-
+
{% endblock %}
\ No newline at end of file
diff --git a/resources/templates/base-authenticated copy.html b/resources/templates/base-unauthenticated.html
similarity index 66%
rename from resources/templates/base-authenticated copy.html
rename to resources/templates/base-unauthenticated.html
index 22af08a..cfb278f 100644
--- a/resources/templates/base-authenticated copy.html
+++ b/resources/templates/base-unauthenticated.html
@@ -1,30 +1,22 @@
-
+
-
-
+
+
-
- {{title}}
+ {% block title %}{% endblock %}{{title}}
- {% block whole-page %}
- {% block top %}
- We're not going to do login in the long term; we're going to use oauth.
+ We're not going to do login in the long term; we're going to use
+ oauth.
This is a temporary login form.
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
index 62a75e9..3333478 100644
--- a/youyesyet.canonical.adl.xml
+++ b/youyesyet.canonical.adl.xml
@@ -64,7 +64,7 @@
All users of the canvasser app Able to read and add canvassing data in a limited
radius around their current position.
-
+ Organisers of canvassing teams Able to see and modify data on the canvassers in
the team(s) they organise; able to add canvassers to their team; able to update canvassers in
their team, including resetting passwords and locking accounts; able to see canvass data over
@@ -115,6 +115,13 @@
+
+
+
+
+
+
+ All genders which may be assigned to electors.
@@ -123,13 +130,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -151,12 +158,19 @@
-
+
-
+