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 %}
+
+-
+
+Elector
+
+
+-
+
+All electors known to the system; electors are people believed to be entitled to vote in the current campaign.
+
+
+-
+
+Gender
+
+
+-
+
+All genders which may be assigned to electors.
+
+
+-
+
+Dwelling
+
+
+-
+
+All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live.
+
+
+-
+
+Address
+
+
+-
+
+Addresses of all buildings which contain dwellings.
+
+
+-
+
+Visit
+
+
+-
+
+All visits made by canvassers to dwellings in which opinions were recorded.
+
+
+-
+
+Authority
+
+
+-
+
+Authorities which may authenticate canvassers to the system.
+
+
+-
+
+Issue
+
+
+-
+
+Issues believed to be of interest to electors, about which they may have questions.
+
+
+-
+
+Intention
+
+
+-
+
+Link table.
+
+
+-
+
+Canvasser
+
+
+-
+
+Primary users of the system: those actually interviewing electors.
+
+
+-
+
+Followuprequest
+
+
+-
+
+Requests for a followup with an issue expert
+
+
+-
+
+Rolemembership
+
+
+-
+
+Link table
+
+
+-
+
+Role
+
+
+-
+
+A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.
+
+
+-
+
+Team
+
+
+-
+
+-
+
+District
+
+
+-
+
+Electoral districts
+
+
+-
+
+Teamorganisership
+
+
+-
+
+Link table
+
+
+-
+
+Followupaction
+
+
+-
+
+Actions taken on followup requests.
+
+
+-
+
+Issueexpertise
+
+
+-
+
+Link table
+
+
+-
+
+Option
+
+
+-
+
+Options in the election or referendum being canvassed on
+
+
+-
+
+Teammembership
+
+
+-
+
+Link table
+
+
+-
+
+Followupmethod
+
+
+-
+
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html
new file mode 100644
index 0000000..b07e39b
--- /dev/null
+++ b/resources/templates/auto/form-addresses-Address.html
@@ -0,0 +1,232 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-canvassers-Canvasser.html b/resources/templates/auto/form-canvassers-Canvasser.html
new file mode 100644
index 0000000..97cbc37
--- /dev/null
+++ b/resources/templates/auto/form-canvassers-Canvasser.html
@@ -0,0 +1,317 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-districts-District.html b/resources/templates/auto/form-districts-District.html
new file mode 100644
index 0000000..a70e74b
--- /dev/null
+++ b/resources/templates/auto/form-districts-District.html
@@ -0,0 +1,82 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-dwellings-Dwelling.html b/resources/templates/auto/form-dwellings-Dwelling.html
new file mode 100644
index 0000000..ea520e7
--- /dev/null
+++ b/resources/templates/auto/form-dwellings-Dwelling.html
@@ -0,0 +1,120 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-electors-Elector.html b/resources/templates/auto/form-electors-Elector.html
new file mode 100644
index 0000000..7b0b158
--- /dev/null
+++ b/resources/templates/auto/form-electors-Elector.html
@@ -0,0 +1,212 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-followupactions-Followupaction.html b/resources/templates/auto/form-followupactions-Followupaction.html
new file mode 100644
index 0000000..8143647
--- /dev/null
+++ b/resources/templates/auto/form-followupactions-Followupaction.html
@@ -0,0 +1,204 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-issues-Issue.html b/resources/templates/auto/form-issues-Issue.html
new file mode 100644
index 0000000..7bec673
--- /dev/null
+++ b/resources/templates/auto/form-issues-Issue.html
@@ -0,0 +1,123 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-roles-Role.html b/resources/templates/auto/form-roles-Role.html
new file mode 100644
index 0000000..029740f
--- /dev/null
+++ b/resources/templates/auto/form-roles-Role.html
@@ -0,0 +1,82 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-teams-Team.html b/resources/templates/auto/form-teams-Team.html
new file mode 100644
index 0000000..f81dbc7
--- /dev/null
+++ b/resources/templates/auto/form-teams-Team.html
@@ -0,0 +1,195 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/form-visits-Visit.html b/resources/templates/auto/form-visits-Visit.html
new file mode 100644
index 0000000..8b6c093
--- /dev/null
+++ b/resources/templates/auto/form-visits-Visit.html
@@ -0,0 +1,148 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-addresses-Addresses.html b/resources/templates/auto/list-addresses-Addresses.html
new file mode 100644
index 0000000..0a62aa0
--- /dev/null
+++ b/resources/templates/auto/list-addresses-Addresses.html
@@ -0,0 +1,115 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-canvassers-Canvassers.html b/resources/templates/auto/list-canvassers-Canvassers.html
new file mode 100644
index 0000000..1b78cb8
--- /dev/null
+++ b/resources/templates/auto/list-canvassers-Canvassers.html
@@ -0,0 +1,133 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-districts-Districts.html b/resources/templates/auto/list-districts-Districts.html
new file mode 100644
index 0000000..9b41182
--- /dev/null
+++ b/resources/templates/auto/list-districts-Districts.html
@@ -0,0 +1,70 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-dwellings-Dwellings.html b/resources/templates/auto/list-dwellings-Dwellings.html
new file mode 100644
index 0000000..c8e5600
--- /dev/null
+++ b/resources/templates/auto/list-dwellings-Dwellings.html
@@ -0,0 +1,79 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-electors-Electors.html b/resources/templates/auto/list-electors-Electors.html
new file mode 100644
index 0000000..ea6102b
--- /dev/null
+++ b/resources/templates/auto/list-electors-Electors.html
@@ -0,0 +1,106 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-followupactions-Followupactions.html b/resources/templates/auto/list-followupactions-Followupactions.html
new file mode 100644
index 0000000..d6ad6fb
--- /dev/null
+++ b/resources/templates/auto/list-followupactions-Followupactions.html
@@ -0,0 +1,106 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-issues-Issues.html b/resources/templates/auto/list-issues-Issues.html
new file mode 100644
index 0000000..f72dafb
--- /dev/null
+++ b/resources/templates/auto/list-issues-Issues.html
@@ -0,0 +1,79 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-roles-Roles.html b/resources/templates/auto/list-roles-Roles.html
new file mode 100644
index 0000000..65b7e89
--- /dev/null
+++ b/resources/templates/auto/list-roles-Roles.html
@@ -0,0 +1,70 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-teams-Teams.html b/resources/templates/auto/list-teams-Teams.html
new file mode 100644
index 0000000..a9b805f
--- /dev/null
+++ b/resources/templates/auto/list-teams-Teams.html
@@ -0,0 +1,97 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/resources/templates/auto/list-visits-Visits.html b/resources/templates/auto/list-visits-Visits.html
new file mode 100644
index 0000000..7faee46
--- /dev/null
+++ b/resources/templates/auto/list-visits-Visits.html
@@ -0,0 +1,88 @@
+{% extends "templates/base.html" %}
+
+
+
+{% block content %}
+
+
+{% endblock %}
diff --git a/src/clj/youyesyet/authorisation.clj b/src/clj/youyesyet/authorisation.clj
new file mode 100644
index 0000000..2ca529b
--- /dev/null
+++ b/src/clj/youyesyet/authorisation.clj
@@ -0,0 +1,4 @@
+(ns ^{:doc "Field-level authorisation. Messy."
+ :author "Simon Brooke"}
+ youyesyet.authorisation
+ (:require [youyesyet.env :refer [defaults]]))
diff --git a/src/clj/youyesyet/routes/auto.clj b/src/clj/youyesyet/routes/auto.clj
new file mode 100644
index 0000000..82d865d
--- /dev/null
+++ b/src/clj/youyesyet/routes/auto.clj
@@ -0,0 +1,639 @@
+(ns
+ youyesyet.routes.auto
+ "JSON routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180610T194402.765Z"
+ (: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.routes.manual :as m]))
+
+(defn
+ raw-resolve-template
+ [n]
+ (if
+ (.exists (io/as-file (str "resources/templates/" n)))
+ n
+ (str "auto/n")))
+
+(def resolve-template (memoise raw-resolve-template))
+
+(defn
+ list-electors-Electors
+ [r]
+ (layout/render
+ (resolve-template "list-electors-Electors.html")
+ {:title "Elector"}))
+
+(defn
+ form-electors-Elector
+ [r]
+ (layout/render
+ (resolve-template "form-electors-Elector.html")
+ {:title "Elector"}))
+
+(defn
+ list-genders-Genders
+ [r]
+ (layout/render
+ (resolve-template "list-genders-Genders.html")
+ {:title "Gender"}))
+
+(defn
+ form-genders-Gender
+ [r]
+ (layout/render
+ (resolve-template "form-genders-Gender.html")
+ {:title "Gender"}))
+
+(defn
+ list-dwellings-Dwellings
+ [r]
+ (layout/render
+ (resolve-template "list-dwellings-Dwellings.html")
+ {:title "Dwelling"}))
+
+(defn
+ form-dwellings-Dwelling
+ [r]
+ (layout/render
+ (resolve-template "form-dwellings-Dwelling.html")
+ {:title "Dwelling"}))
+
+(defn
+ list-addresses-Addresses
+ [r]
+ (layout/render
+ (resolve-template "list-addresses-Addresses.html")
+ {:title "Address"}))
+
+(defn
+ form-addresses-Address
+ [r]
+ (layout/render
+ (resolve-template "form-addresses-Address.html")
+ {:title "Address"}))
+
+(defn
+ list-visits-Visits
+ [r]
+ (layout/render
+ (resolve-template "list-visits-Visits.html")
+ {:title "Visit"}))
+
+(defn
+ form-visits-Visit
+ [r]
+ (layout/render
+ (resolve-template "form-visits-Visit.html")
+ {:title "Visit"}))
+
+(defn
+ list-authorities-Authorities
+ [r]
+ (layout/render
+ (resolve-template "list-authorities-Authorities.html")
+ {:title "Authority"}))
+
+(defn
+ form-authorities-Authority
+ [r]
+ (layout/render
+ (resolve-template "form-authorities-Authority.html")
+ {:title "Authority"}))
+
+(defn
+ list-issues-Issues
+ [r]
+ (layout/render
+ (resolve-template "list-issues-Issues.html")
+ {:title "Issue"}))
+
+(defn
+ form-issues-Issue
+ [r]
+ (layout/render
+ (resolve-template "form-issues-Issue.html")
+ {:title "Issue"}))
+
+(defn
+ list-intentions-Intentions
+ [r]
+ (layout/render
+ (resolve-template "list-intentions-Intentions.html")
+ {:title "Intention"}))
+
+(defn
+ form-intentions-Intention
+ [r]
+ (layout/render
+ (resolve-template "form-intentions-Intention.html")
+ {:title "Intention"}))
+
+(defn
+ list-canvassers-Canvassers
+ [r]
+ (layout/render
+ (resolve-template "list-canvassers-Canvassers.html")
+ {:title "Canvasser"}))
+
+(defn
+ form-canvassers-Canvasser
+ [r]
+ (layout/render
+ (resolve-template "form-canvassers-Canvasser.html")
+ {:title "Canvasser"}))
+
+(defn
+ list-followuprequests-Followuprequests
+ [r]
+ (layout/render
+ (resolve-template "list-followuprequests-Followuprequests.html")
+ {:title "Followuprequest"}))
+
+(defn
+ form-followuprequests-Followuprequest
+ [r]
+ (layout/render
+ (resolve-template "form-followuprequests-Followuprequest.html")
+ {:title "Followuprequest"}))
+
+(defn
+ list-roles-Roles
+ [r]
+ (layout/render
+ (resolve-template "list-roles-Roles.html")
+ {:title "Role"}))
+
+(defn
+ form-roles-Role
+ [r]
+ (layout/render
+ (resolve-template "form-roles-Role.html")
+ {:title "Role"}))
+
+(defn
+ list-teams-Teams
+ [r]
+ (layout/render
+ (resolve-template "list-teams-Teams.html")
+ {:title "Team"}))
+
+(defn
+ form-teams-Team
+ [r]
+ (layout/render
+ (resolve-template "form-teams-Team.html")
+ {:title "Team"}))
+
+(defn
+ list-districts-Districts
+ [r]
+ (layout/render
+ (resolve-template "list-districts-Districts.html")
+ {:title "District"}))
+
+(defn
+ form-districts-District
+ [r]
+ (layout/render
+ (resolve-template "form-districts-District.html")
+ {:title "District"}))
+
+(defn
+ list-followupactions-Followupactions
+ [r]
+ (layout/render
+ (resolve-template "list-followupactions-Followupactions.html")
+ {:title "Followupaction"}))
+
+(defn
+ form-followupactions-Followupaction
+ [r]
+ (layout/render
+ (resolve-template "form-followupactions-Followupaction.html")
+ {:title "Followupaction"}))
+
+(defn
+ list-options-Options
+ [r]
+ (layout/render
+ (resolve-template "list-options-Options.html")
+ {:title "Option"}))
+
+(defn
+ form-options-Option
+ [r]
+ (layout/render
+ (resolve-template "form-options-Option.html")
+ {:title "Option"}))
+
+(defn
+ list-followupmethods-Followupmethods
+ [r]
+ (layout/render
+ (resolve-template "list-followupmethods-Followupmethods.html")
+ {:title "Followupmethod"}))
+
+(defn
+ form-followupmethods-Followupmethod
+ [r]
+ (layout/render
+ (resolve-template "form-followupmethods-Followupmethod.html")
+ {:title "Followupmethod"}))
+
+(defn
+ 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)))))
+
+(def resolve-handler (memoize raw-resolve-handler))
+
+(defroutes
+ auto-selmer-routes
+ (GET
+ "/form-addresses-Address"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-addresses-Address") (list request))))
+ (POST
+ "/form-addresses-Address"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-addresses-Address") (list request))))
+ (GET
+ "/form-authorities-Authority"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-authorities-Authority")
+ (list request))))
+ (POST
+ "/form-authorities-Authority"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-authorities-Authority")
+ (list request))))
+ (GET
+ "/form-canvassers-Canvasser"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-canvassers-Canvasser")
+ (list request))))
+ (POST
+ "/form-canvassers-Canvasser"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-canvassers-Canvasser")
+ (list request))))
+ (GET
+ "/form-districts-District"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-districts-District") (list request))))
+ (POST
+ "/form-districts-District"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-districts-District") (list request))))
+ (GET
+ "/form-dwellings-Dwelling"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-dwellings-Dwelling") (list request))))
+ (POST
+ "/form-dwellings-Dwelling"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-dwellings-Dwelling") (list request))))
+ (GET
+ "/form-electors-Elector"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-electors-Elector") (list request))))
+ (POST
+ "/form-electors-Elector"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-electors-Elector") (list request))))
+ (GET
+ "/form-followupactions-Followupaction"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-followupactions-Followupaction")
+ (list request))))
+ (POST
+ "/form-followupactions-Followupaction"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-followupactions-Followupaction")
+ (list request))))
+ (GET
+ "/form-followupmethods-Followupmethod"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-followupmethods-Followupmethod")
+ (list request))))
+ (POST
+ "/form-followupmethods-Followupmethod"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-followupmethods-Followupmethod")
+ (list request))))
+ (GET
+ "/form-followuprequests-Followuprequest"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-followuprequests-Followuprequest")
+ (list request))))
+ (POST
+ "/form-followuprequests-Followuprequest"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-followuprequests-Followuprequest")
+ (list request))))
+ (GET
+ "/form-genders-Gender"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-genders-Gender") (list request))))
+ (POST
+ "/form-genders-Gender"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-genders-Gender") (list request))))
+ (GET
+ "/form-intentions-Intention"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-intentions-Intention")
+ (list request))))
+ (POST
+ "/form-intentions-Intention"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "form-intentions-Intention")
+ (list request))))
+ (GET
+ "/form-issues-Issue"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-issues-Issue") (list request))))
+ (POST
+ "/form-issues-Issue"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-issues-Issue") (list request))))
+ (GET
+ "/form-options-Option"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-options-Option") (list request))))
+ (POST
+ "/form-options-Option"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-options-Option") (list request))))
+ (GET
+ "/form-roles-Role"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-roles-Role") (list request))))
+ (POST
+ "/form-roles-Role"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-roles-Role") (list request))))
+ (GET
+ "/form-teams-Team"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-teams-Team") (list request))))
+ (POST
+ "/form-teams-Team"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-teams-Team") (list request))))
+ (GET
+ "/form-visits-Visit"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-visits-Visit") (list request))))
+ (POST
+ "/form-visits-Visit"
+ request
+ (route/restricted
+ (apply (resolve-handler "form-visits-Visit") (list request))))
+ (GET
+ "/list-addresses-Addresses"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-addresses-Addresses")
+ (list request))))
+ (POST
+ "/list-addresses-Addresses"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-addresses-Addresses")
+ (list request))))
+ (GET
+ "/list-authorities-Authorities"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-authorities-Authorities")
+ (list request))))
+ (POST
+ "/list-authorities-Authorities"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-authorities-Authorities")
+ (list request))))
+ (GET
+ "/list-canvassers-Canvassers"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-canvassers-Canvassers")
+ (list request))))
+ (POST
+ "/list-canvassers-Canvassers"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-canvassers-Canvassers")
+ (list request))))
+ (GET
+ "/list-districts-Districts"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-districts-Districts")
+ (list request))))
+ (POST
+ "/list-districts-Districts"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-districts-Districts")
+ (list request))))
+ (GET
+ "/list-dwellings-Dwellings"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-dwellings-Dwellings")
+ (list request))))
+ (POST
+ "/list-dwellings-Dwellings"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-dwellings-Dwellings")
+ (list request))))
+ (GET
+ "/list-electors-Electors"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-electors-Electors") (list request))))
+ (POST
+ "/list-electors-Electors"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-electors-Electors") (list request))))
+ (GET
+ "/list-followupactions-Followupactions"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-followupactions-Followupactions")
+ (list request))))
+ (POST
+ "/list-followupactions-Followupactions"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-followupactions-Followupactions")
+ (list request))))
+ (GET
+ "/list-followupmethods-Followupmethods"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-followupmethods-Followupmethods")
+ (list request))))
+ (POST
+ "/list-followupmethods-Followupmethods"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-followupmethods-Followupmethods")
+ (list request))))
+ (GET
+ "/list-followuprequests-Followuprequests"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-followuprequests-Followuprequests")
+ (list request))))
+ (POST
+ "/list-followuprequests-Followuprequests"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-followuprequests-Followuprequests")
+ (list request))))
+ (GET
+ "/list-genders-Genders"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-genders-Genders") (list request))))
+ (POST
+ "/list-genders-Genders"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-genders-Genders") (list request))))
+ (GET
+ "/list-intentions-Intentions"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-intentions-Intentions")
+ (list request))))
+ (POST
+ "/list-intentions-Intentions"
+ request
+ (route/restricted
+ (apply
+ (resolve-handler "list-intentions-Intentions")
+ (list request))))
+ (GET
+ "/list-issues-Issues"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-issues-Issues") (list request))))
+ (POST
+ "/list-issues-Issues"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-issues-Issues") (list request))))
+ (GET
+ "/list-options-Options"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-options-Options") (list request))))
+ (POST
+ "/list-options-Options"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-options-Options") (list request))))
+ (GET
+ "/list-roles-Roles"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-roles-Roles") (list request))))
+ (POST
+ "/list-roles-Roles"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-roles-Roles") (list request))))
+ (GET
+ "/list-teams-Teams"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-teams-Teams") (list request))))
+ (POST
+ "/list-teams-Teams"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-teams-Teams") (list request))))
+ (GET
+ "/list-visits-Visits"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-visits-Visits") (list request))))
+ (POST
+ "/list-visits-Visits"
+ request
+ (route/restricted
+ (apply (resolve-handler "list-visits-Visits") (list request)))))
+
diff --git a/youyesyet.adl.xml b/youyesyet.adl.xml
index 18884fd..98b0593 100644
--- a/youyesyet.adl.xml
+++ b/youyesyet.adl.xml
@@ -56,6 +56,7 @@
+ All electors known to the system; electors are people believed to be entitled to vote in the current campaign.
@@ -64,7 +65,7 @@
-
+
@@ -81,6 +82,7 @@
+ All genders which may be assigned to electors.
@@ -90,6 +92,7 @@
+ All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live.
@@ -99,8 +102,11 @@
+
+
+ Addresses of all buildings which contain dwellings.
@@ -131,6 +137,7 @@
+ All visits made by canvassers to dwellings in which opinions were recorded.
@@ -149,13 +156,18 @@
+
+
+ Authorities which may authenticate canvassers to the system.
+
+
Issues believed to be of interest to electors, about which they may have questions.
@@ -187,6 +199,8 @@
column="option_id">
+
+
Primary users of the system: those actually interviewing electors.
@@ -221,6 +235,9 @@
+
+
+
But only their own record
@@ -230,6 +247,8 @@
All canvassers
+
+
Requests for a followup with an issue expert
@@ -254,6 +273,8 @@
entity="followupmethods" farkey="id">
+
+
Link table
@@ -276,6 +297,8 @@
+
+
@@ -293,6 +316,9 @@
+
+
+
@@ -303,6 +329,8 @@
All groups
+
+
Electoral districts
@@ -316,6 +344,8 @@
+
+
Link table
@@ -357,6 +387,8 @@
But only for electors in their immediate vicinity
+
+
Link table
@@ -380,6 +412,8 @@
+
+
Link table
@@ -398,5 +432,7 @@
+
+
diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml
index 9939cad..18a2de3 100644
--- a/youyesyet.canonical.adl.xml
+++ b/youyesyet.canonical.adl.xml
@@ -67,6 +67,7 @@
entity electors already has a key - not generating one
-->
+ All electors known to the system; electors are people believed to be entitled to vote in the current campaign.
@@ -75,7 +76,7 @@
-
+
@@ -87,10 +88,11 @@
-
-
+
+
+ All genders which may be assigned to electors.
@@ -104,16 +106,21 @@
-
+
+
+
+ All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live.
@@ -123,11 +130,14 @@
+
+
+ Addresses of all buildings which contain dwellings.
@@ -154,13 +164,14 @@
-
-
+
+
+ All visits made by canvassers to dwellings in which opinions were recorded.
@@ -177,16 +188,21 @@
+
+
+ Authorities which may authenticate canvassers to the system.
+
+
-
+
Link table.
@@ -236,6 +252,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
Link table
@@ -488,6 +544,8 @@
+
+