From bfb5a672664231b9ef43331ffb4f607c9bad8425 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Thu, 14 Jun 2018 21:33:20 +0100 Subject: [PATCH] Further work on auto-generation of components --- .gitignore | 2 + .../20180317170907-reference-data.up.sql | 8 + .../20180611204244-bootstrap.up.sql | 10 +- resources/sql/queries.auto.sql | 330 +++++----------- .../templates/auto/application-index.html | 44 +-- .../auto/form-addresses-Address.html | 2 +- .../auto/form-authorities-Authority.html | 131 +++++++ .../auto/form-canvassers-Canvasser.html | 13 +- .../auto/form-districts-District.html | 2 +- .../auto/form-dwellings-Dwelling.html | 10 +- .../templates/auto/form-electors-Elector.html | 6 +- .../form-followupactions-Followupaction.html | 6 +- .../form-followupmethods-Followupmethod.html | 131 +++++++ ...form-followuprequests-Followuprequest.html | 266 +++++++++++++ .../templates/auto/form-genders-Gender.html | 131 +++++++ .../auto/form-intentions-Intention.html | 202 ++++++++++ .../templates/auto/form-issues-Issue.html | 2 +- .../templates/auto/form-options-Option.html | 131 +++++++ resources/templates/auto/form-roles-Role.html | 2 +- resources/templates/auto/form-teams-Team.html | 21 +- .../templates/auto/form-visits-Visit.html | 2 +- .../auto/list-addresses-Addresses.html | 2 +- .../auto/list-authorities-Authorities.html | 118 ++++++ .../auto/list-canvassers-Canvassers.html | 2 +- .../auto/list-districts-Districts.html | 2 +- .../auto/list-dwellings-Dwellings.html | 2 +- .../auto/list-electors-Electors.html | 2 +- .../list-followupactions-Followupactions.html | 2 +- .../list-followupmethods-Followupmethods.html | 118 ++++++ ...ist-followuprequests-Followuprequests.html | 154 ++++++++ .../templates/auto/list-genders-Genders.html | 118 ++++++ .../auto/list-intentions-Intentions.html | 136 +++++++ .../templates/auto/list-issues-Issues.html | 2 +- .../templates/auto/list-options-Options.html | 118 ++++++ .../templates/auto/list-roles-Roles.html | 2 +- .../templates/auto/list-teams-Teams.html | 2 +- .../templates/auto/list-visits-Visits.html | 2 +- src/clj/youyesyet/db/core.clj | 4 +- src/clj/youyesyet/handler.clj | 19 +- src/clj/youyesyet/routes/auto.clj | 2 +- src/clj/youyesyet/routes/auto_json.clj | 365 +----------------- youyesyet.adl.xml | 226 +++++++---- youyesyet.canonical.adl.xml | 315 ++++++++------- 43 files changed, 2254 insertions(+), 911 deletions(-) create mode 100644 resources/templates/auto/form-authorities-Authority.html create mode 100644 resources/templates/auto/form-followupmethods-Followupmethod.html create mode 100644 resources/templates/auto/form-followuprequests-Followuprequest.html create mode 100644 resources/templates/auto/form-genders-Gender.html create mode 100644 resources/templates/auto/form-intentions-Intention.html create mode 100644 resources/templates/auto/form-options-Option.html create mode 100644 resources/templates/auto/list-authorities-Authorities.html create mode 100644 resources/templates/auto/list-followupmethods-Followupmethods.html create mode 100644 resources/templates/auto/list-followuprequests-Followuprequests.html create mode 100644 resources/templates/auto/list-genders-Genders.html create mode 100644 resources/templates/auto/list-intentions-Intentions.html create mode 100644 resources/templates/auto/list-options-Options.html diff --git a/.gitignore b/.gitignore index bf93d93..fa895de 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ pom.xml.asc profiles\.clj .bowerrc bower.json + +src/clj/youyesyet/scratchpad\.clj diff --git a/resources/migrations/20180317170907-reference-data.up.sql b/resources/migrations/20180317170907-reference-data.up.sql index 0ab0f4c..ed1dfa4 100644 --- a/resources/migrations/20180317170907-reference-data.up.sql +++ b/resources/migrations/20180317170907-reference-data.up.sql @@ -8,3 +8,11 @@ insert into issues (id, url) values ('Currency', 'https://www.yyy.scot/wiki/issu insert into issues (id, url) values ('Monarchy', 'https://www.yyy.scot/wiki/issues/Monarchy'); insert into issues (id, url) values ('Defence', 'https://www.yyy.scot/wiki/issues/Defence'); + +insert into genders (id ) values ('Female'); + +insert into genders (id ) values ('Male'); + +insert into genders (id ) values ('Non-binary'); + +insert into genders (id ) values ('Unknown'); diff --git a/resources/migrations/20180611204244-bootstrap.up.sql b/resources/migrations/20180611204244-bootstrap.up.sql index c63cfe3..d0377ad 100644 --- a/resources/migrations/20180611204244-bootstrap.up.sql +++ b/resources/migrations/20180611204244-bootstrap.up.sql @@ -1,15 +1,15 @@ -- enough data to get the system working and real logins -insert into addresses (id, address, postcode, latitude, longitude) -values (5, 'West Croft, Standingstone, Auchencairn', 'DG7 1RF', 54.822389, -3.920265); +insert into addresses (address, postcode, latitude, longitude) +values ('West Croft, Standingstone, Auchencairn', 'DG7 1RF', 54.822389, -3.920265); insert into dwellings (id, address_id, sub_address) values (5, 5, ''); -insert into electors (id, name, dwelling_id, gender) -values (11, 'Simon Brooke', 5, 'Male'); +insert into electors (name, dwelling_id, gender) +values ('Simon Brooke', 1, 'Male'); insert into authorities (id) values ('GitHub'); insert into canvassers (username, fullname, elector_id, address_id, authority_id, authorised) -values ('simon_brooke', 'Simon Brooke', 11, 5, 'GitHub', true); +values ('simon_brooke', 'Simon Brooke', 2, 2, 'GitHub', true); diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql index 63625ad..ac503e2 100644 --- a/resources/sql/queries.auto.sql +++ b/resources/sql/queries.auto.sql @@ -1,9 +1,11 @@ --- File queries.sql --- autogenerated by adl.to-hugsql-queries at --- 2018-06-11T20:39:10.396Z --- See [Application Description Language](https://github.com/simon-brooke/adl). - - +------------------------------------------------------------------------ +-- File queries.sql +-- +-- autogenerated by adl.to-hugsql-queries at 2018-06-14T17:56:42.346Z +-- +-- See [Application Description +-- Language](https://github.com/simon-brooke/adl). +------------------------------------------------------------------------ -- :name create-address! :! :n -- :doc creates a new address record @@ -12,13 +14,15 @@ INSERT INTO addresses (address, phone, district_id, latitude, - longitude) + longitude, + locality) VALUES (:address, :postcode, :phone, :district_id, :latitude, - :longitude) + :longitude, + :locality) returning id -- :name create-authority! :! :n @@ -133,16 +137,6 @@ VALUES (:url, :id) returning 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) -returning Id - -- :name create-option! :! :n -- :doc creates a new option record INSERT INTO options (id) @@ -155,14 +149,6 @@ INSERT INTO roles (name) VALUES (:name) returning id --- :name create-rolemembership! :! :n --- :doc creates a new rolemembership record -INSERT INTO rolememberships (role_id, - canvasser_id) -VALUES (:role_id, - :canvasser_id) -returning Id - -- :name create-team! :! :n -- :doc creates a new team record INSERT INTO teams (name, @@ -175,22 +161,6 @@ VALUES (:name, :longitude) returning id --- :name create-teammembership! :! :n --- :doc creates a new teammembership record -INSERT INTO teammemberships (team_id, - canvasser_id) -VALUES (:team_id, - :canvasser_id) -returning Id - --- :name create-teamorganisership! :! :n --- :doc creates a new teamorganisership record -INSERT INTO teamorganiserships (team_id, - canvasser_id) -VALUES (:team_id, - :canvasser_id) -returning Id - -- :name create-visit! :! :n -- :doc creates a new visit record INSERT INTO visits (address_id, @@ -261,11 +231,6 @@ WHERE intentions.Id = :Id DELETE FROM issues WHERE issues.id = :id --- :name delete-issueexpertise! :! :n --- :doc updates an existing issueexpertise record -DELETE FROM issueexpertise -WHERE issueexpertise.Id = :Id - -- :name delete-option! :! :n -- :doc updates an existing option record DELETE FROM options @@ -276,26 +241,11 @@ WHERE options.id = :id 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 @@ -343,6 +293,9 @@ ORDER BY districts.name, -- :doc selects an existing dwelling record SELECT * FROM dwellings WHERE dwellings.id = :id +ORDER BY dwellings.address_id, + dwellings.sub-address, + dwellings.id -- :name get-elector :? :1 -- :doc selects an existing elector record @@ -351,12 +304,16 @@ WHERE electors.id = :id ORDER BY electors.name, electors.phone, electors.email, + electors.gender, electors.id -- :name get-followupaction :? :1 -- :doc selects an existing followupaction record SELECT * FROM followupactions WHERE followupactions.id = :id +ORDER BY followupactions.date, + followupactions.notes, + followupactions.id -- :name get-followupmethod :? :1 -- :doc selects an existing followupmethod record @@ -367,6 +324,10 @@ WHERE followupmethods.id = :id -- :doc selects an existing followuprequest record SELECT * FROM followuprequests WHERE followuprequests.id = :id +ORDER BY followuprequests.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + followuprequests.id -- :name get-gender :? :1 -- :doc selects an existing gender record @@ -383,11 +344,6 @@ WHERE intentions.Id = :Id SELECT * FROM issues WHERE issues.id = :id --- :name get-issueexpertise :? :1 --- :doc selects an existing issueexpertise record -SELECT * FROM issueexpertise -WHERE issueexpertise.Id = :Id - -- :name get-option :? :1 -- :doc selects an existing option record SELECT * FROM options @@ -400,10 +356,12 @@ 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-role-by-name :? :1 +-- :doc selects an existing role record +SELECT * FROM roles +WHERE roles.name = :name +ORDER BY roles.name, + roles.id -- :name get-team :? :1 -- :doc selects an existing team record @@ -412,20 +370,13 @@ 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 +ORDER BY visits.address_id, + visits.date, + visits.id -- :name list-addresses :? :* -- :doc lists all existing address records @@ -494,9 +445,9 @@ ORDER BY canvassers.username, -- :name list-canvassers-by-role :? :* -- :doc links all existing canvasser records related to a given role SELECT * -FROM canvassers, link_canvassers_ -WHERE canvassers.id = link_canvassers_.canvasser_id - AND link_canvassers_.role_id = :id +FROM canvassers, ln_canvassers_roles +WHERE canvassers.id = ln_canvassers_roles.canvasser_id + AND ln_canvassers_roles.role_id = :id ORDER BY canvassers.username, canvassers.fullname, canvassers.email, @@ -513,6 +464,9 @@ ORDER BY districts.name, -- :name list-dwellings :? :* -- :doc lists all existing dwelling records SELECT * FROM dwellings +ORDER BY dwellings.address_id, + dwellings.sub-address, + dwellings.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -521,6 +475,9 @@ SELECT * FROM dwellings SELECT * FROM dwellings WHERE dwellings.address_id = :id +ORDER BY dwellings.address_id, + dwellings.sub-address, + dwellings.id -- :name list-electors :? :* -- :doc lists all existing elector records @@ -528,6 +485,7 @@ SELECT * FROM electors ORDER BY electors.name, electors.phone, electors.email, + electors.gender, electors.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -540,6 +498,7 @@ WHERE electors.dwelling_id = :id ORDER BY electors.name, electors.phone, electors.email, + electors.gender, electors.id -- :name list-electors-by-gender :? :* @@ -550,11 +509,15 @@ WHERE electors.gender = :id ORDER BY electors.name, electors.phone, electors.email, + electors.gender, electors.id -- :name list-followupactions :? :* -- :doc lists all existing followupaction records SELECT * FROM followupactions +ORDER BY followupactions.date, + followupactions.notes, + followupactions.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -563,12 +526,18 @@ SELECT * FROM followupactions SELECT * FROM followupactions WHERE followupactions.actor = :id +ORDER BY followupactions.date, + followupactions.notes, + followupactions.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.date, + followupactions.notes, + followupactions.id -- :name list-followupmethods :? :* -- :doc lists all existing followupmethod records @@ -579,6 +548,10 @@ SELECT * FROM followupmethods -- :name list-followuprequests :? :* -- :doc lists all existing followuprequest records SELECT * FROM followuprequests +ORDER BY followuprequests.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + followuprequests.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -587,24 +560,40 @@ SELECT * FROM followuprequests SELECT * FROM followuprequests WHERE followuprequests.elector_id = :id +ORDER BY followuprequests.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + 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.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + followuprequests.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.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + followuprequests.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.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + followuprequests.id -- :name list-genders :? :* -- :doc lists all existing gender records @@ -636,30 +625,6 @@ SELECT * FROM intentions WHERE intentions.visit_id = :id --- :name list-issueexpertise :? :* --- :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 issueexpertise records related to a given canvasser -SELECT * -FROM issueexpertise -WHERE issueexpertise.canvasser_id = :id - --- :name list-issueexpertise-by-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 issueexpertise 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 @@ -672,24 +637,6 @@ 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 @@ -701,48 +648,12 @@ ORDER BY roles.name, -- :name list-roles-by-canvasser :? :* -- :doc links all existing role records related to a given canvasser SELECT * -FROM roles, link_roles_canvassers -WHERE roles.id = link_roles_canvassers.role_id - AND link_roles_canvassers.canvasser_id = :id +FROM roles, ln_canvassers_roles +WHERE roles.id = ln_canvassers_roles.role_id + AND ln_canvassers_roles.canvasser_id = :id ORDER BY roles.name, roles.id --- :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 @@ -754,9 +665,9 @@ ORDER BY teams.name, -- :name list-teams-by-canvasser :? :* -- :doc links all existing team records related to a given canvasser SELECT * -FROM teams, link_teams_canvassers -WHERE teams.id = link_teams_canvassers.team_id - AND link_teams_canvassers.canvasser_id = :id +FROM teams, ln_canvassers_teams +WHERE teams.id = ln_canvassers_teams.team_id + AND ln_canvassers_teams.canvasser_id = :id ORDER BY teams.name, teams.id @@ -771,6 +682,9 @@ ORDER BY teams.name, -- :name list-visits :? :* -- :doc lists all existing visit records SELECT * FROM visits +ORDER BY visits.address_id, + visits.date, + visits.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -779,12 +693,18 @@ SELECT * FROM visits SELECT * FROM visits WHERE visits.address_id = :id +ORDER BY visits.address_id, + visits.date, + visits.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.address_id, + visits.date, + visits.id -- :name search-strings-address :? :1 -- :doc selects existing address records having any string field matching `:pattern` by substring match @@ -836,6 +756,9 @@ ORDER BY districts.name, SELECT * FROM dwellings WHERE sub-address LIKE '%:pattern%' +ORDER BY dwellings.address_id, + dwellings.sub-address, + dwellings.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -849,6 +772,7 @@ name LIKE '%:pattern%' ORDER BY electors.name, electors.phone, electors.email, + electors.gender, electors.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -858,6 +782,9 @@ ORDER BY electors.name, SELECT * FROM followupactions WHERE notes LIKE '%:pattern%' +ORDER BY followupactions.date, + followupactions.notes, + followupactions.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -873,6 +800,10 @@ id LIKE '%:pattern%' -- :doc selects existing followuprequest records having any string field matching `:pattern` by substring match SELECT * FROM followuprequests WHERE +ORDER BY followuprequests.elector_id, + followuprequests.visit_id, + followuprequests.issue_id, + followuprequests.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -900,13 +831,6 @@ url 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 @@ -925,13 +849,6 @@ 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 @@ -942,24 +859,13 @@ ORDER BY teams.name, --~ (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 +ORDER BY visits.address_id, + visits.date, + visits.id --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") @@ -971,7 +877,8 @@ SET address = :address, phone = :phone, district_id = :district_id, latitude = :latitude, - longitude = :longitude + longitude = :longitude, + locality = :locality WHERE addresses.id = :id -- :name update-canvasser! :! :n @@ -1045,27 +952,12 @@ SET url = :url, 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 @@ -1075,20 +967,6 @@ SET name = :name, 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 diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html index 3ebe8f0..3b4a12a 100644 --- a/resources/templates/auto/application-index.html +++ b/resources/templates/auto/application-index.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -123,16 +123,6 @@ Requests for a followup with an issue expert

- -Rolemembership - -
-
-

-Link table -

-
-
Role @@ -156,17 +146,7 @@ District

-Electoral districts -

-
-
- -Teamorganisership - -
-
-

-Link table +Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps.

@@ -180,16 +160,6 @@ Actions taken on followup requests.

- -Issueexpertise - -
-
-

-Link table -

-
-
Option @@ -200,16 +170,6 @@ Options in the election or referendum being canvassed on

- -Teammembership - -
-
-

-Link table -

-
-
Followupmethod diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html index 30af8fe..1a69022 100644 --- a/resources/templates/auto/form-addresses-Address.html +++ b/resources/templates/auto/form-addresses-Address.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/form-authorities-Authority.html b/resources/templates/auto/form-authorities-Authority.html new file mode 100644 index 0000000..b4e7604 --- /dev/null +++ b/resources/templates/auto/form-authorities-Authority.html @@ -0,0 +1,131 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+
+{% csrf-field %} +

+ +{% ifwritable authorities id %} + +{% else %} +{% ifreadable authorities id%} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable authorities %} + +{% else %} +{% ifreadable authorities %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable authorities %} + +{% else %} +{% ifreadable authorities %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ + +

+

+ + +

+
+
+ +{% 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 2df601e..59115bc 100644 --- a/resources/templates/auto/form-canvassers-Canvasser.html +++ b/resources/templates/auto/form-canvassers-Canvasser.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -75,7 +75,7 @@ elector_id
{% else %} @@ -216,7 +216,7 @@ elector_id
{% else %} @@ -312,10 +312,9 @@ authorised roles {% ifwritable canvassers roles %} -
- - +{% for record in roles %}{% endfor %}
{% else %} diff --git a/resources/templates/auto/form-districts-District.html b/resources/templates/auto/form-districts-District.html index 108288b..03bd2cb 100644 --- a/resources/templates/auto/form-districts-District.html +++ b/resources/templates/auto/form-districts-District.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/form-dwellings-Dwelling.html b/resources/templates/auto/form-dwellings-Dwelling.html index 15462c1..1e85f97 100644 --- a/resources/templates/auto/form-dwellings-Dwelling.html +++ b/resources/templates/auto/form-dwellings-Dwelling.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -44,10 +44,10 @@ id address_id {% ifwritable dwellings address_id %} -
+
{% else %} @@ -91,10 +91,10 @@ id address_id {% ifwritable dwellings address_id %} -
+
{% else %} diff --git a/resources/templates/auto/form-electors-Elector.html b/resources/templates/auto/form-electors-Elector.html index c696650..4f21ae4 100644 --- a/resources/templates/auto/form-electors-Elector.html +++ b/resources/templates/auto/form-electors-Elector.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -61,7 +61,7 @@ dwelling_id
{% else %} @@ -154,7 +154,7 @@ dwelling_id
{% else %} diff --git a/resources/templates/auto/form-followupactions-Followupaction.html b/resources/templates/auto/form-followupactions-Followupaction.html index b7b3e1d..371099f 100644 --- a/resources/templates/auto/form-followupactions-Followupaction.html +++ b/resources/templates/auto/form-followupactions-Followupaction.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -47,7 +47,7 @@ request_id
{% else %} @@ -141,7 +141,7 @@ request_id
{% else %} diff --git a/resources/templates/auto/form-followupmethods-Followupmethod.html b/resources/templates/auto/form-followupmethods-Followupmethod.html new file mode 100644 index 0000000..f233b36 --- /dev/null +++ b/resources/templates/auto/form-followupmethods-Followupmethod.html @@ -0,0 +1,131 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+
+{% csrf-field %} +

+ +{% ifwritable followupmethods id %} + +{% else %} +{% ifreadable followupmethods id%} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followupmethods %} + +{% else %} +{% ifreadable followupmethods %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followupmethods %} + +{% else %} +{% ifreadable followupmethods %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ + +

+

+ + +

+
+
+ +{% endblock %} +{% block foot %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/templates/auto/form-followuprequests-Followuprequest.html b/resources/templates/auto/form-followuprequests-Followuprequest.html new file mode 100644 index 0000000..6940865 --- /dev/null +++ b/resources/templates/auto/form-followuprequests-Followuprequest.html @@ -0,0 +1,266 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+
+{% csrf-field %} + +

+ +{% ifwritable followuprequests %} + +{% else %} +{% ifreadable followuprequests %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests elector_id %} +

+ + +
+{% else %} +{% ifreadable followuprequests elector_id%} + +{{record.elector_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests visit_id %} +

+ + +
+{% else %} +{% ifreadable followuprequests visit_id%} + +{{record.visit_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests issue_id %} +

+ +
+{% else %} +{% ifreadable followuprequests issue_id%} + +{{record.issue_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests method_id %} +

+ +
+{% else %} +{% ifreadable followuprequests method_id%} + +{{record.method_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests %} + +{% else %} +{% ifreadable followuprequests %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests elector_id %} +

+ + +
+{% else %} +{% ifreadable followuprequests elector_id%} + +{{record.elector_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests visit_id %} +

+ + +
+{% else %} +{% ifreadable followuprequests visit_id%} + +{{record.visit_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests issue_id %} +

+ +
+{% else %} +{% ifreadable followuprequests issue_id%} + +{{record.issue_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable followuprequests method_id %} +

+ +
+{% else %} +{% ifreadable followuprequests method_id%} + +{{record.method_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ + +

+

+ + +

+
+
+ +{% endblock %} +{% block foot %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/templates/auto/form-genders-Gender.html b/resources/templates/auto/form-genders-Gender.html new file mode 100644 index 0000000..6ad02c0 --- /dev/null +++ b/resources/templates/auto/form-genders-Gender.html @@ -0,0 +1,131 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+
+{% csrf-field %} +

+ +{% ifwritable genders id %} + +{% else %} +{% ifreadable genders id%} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable genders %} + +{% else %} +{% ifreadable genders %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable genders %} + +{% else %} +{% ifreadable genders %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ + +

+

+ + +

+
+
+ +{% endblock %} +{% block foot %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/templates/auto/form-intentions-Intention.html b/resources/templates/auto/form-intentions-Intention.html new file mode 100644 index 0000000..0d6a71d --- /dev/null +++ b/resources/templates/auto/form-intentions-Intention.html @@ -0,0 +1,202 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+
+{% csrf-field %} + +

+ +{% ifwritable intentions visit_id %} +

+ + +
+{% else %} +{% ifreadable intentions visit_id%} + +{{record.visit_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable intentions elector_id %} +

+ + +
+{% else %} +{% ifreadable intentions elector_id%} + +{{record.elector_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable intentions option_id %} +

+ +
+{% else %} +{% ifreadable intentions option_id%} + +{{record.option_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable intentions visit_id %} +

+ + +
+{% else %} +{% ifreadable intentions visit_id%} + +{{record.visit_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable intentions elector_id %} +

+ + +
+{% else %} +{% ifreadable intentions elector_id%} + +{{record.elector_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable intentions option_id %} +

+ +
+{% else %} +{% ifreadable intentions option_id%} + +{{record.option_id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ + +

+

+ + +

+
+
+ +{% 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 c496dcd..141d785 100644 --- a/resources/templates/auto/form-issues-Issue.html +++ b/resources/templates/auto/form-issues-Issue.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/form-options-Option.html b/resources/templates/auto/form-options-Option.html new file mode 100644 index 0000000..9837b1e --- /dev/null +++ b/resources/templates/auto/form-options-Option.html @@ -0,0 +1,131 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+
+{% csrf-field %} +

+ +{% ifwritable options id %} + +{% else %} +{% ifreadable options id%} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable options %} + +{% else %} +{% ifreadable options %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ +{% ifwritable options %} + +{% else %} +{% ifreadable options %} + +{{record.id}} + +{% endifreadable %} +{% endifwritable %} +

+

+ + +

+

+ + +

+
+
+ +{% 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 2215d29..fc4550f 100644 --- a/resources/templates/auto/form-roles-Role.html +++ b/resources/templates/auto/form-roles-Role.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/form-teams-Team.html b/resources/templates/auto/form-teams-Team.html index 17a7abf..964e783 100644 --- a/resources/templates/auto/form-teams-Team.html +++ b/resources/templates/auto/form-teams-Team.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -181,6 +181,25 @@ members {% endifwritable %}

+ +{% ifwritable teams organisers %} +

+ + +
+{% else %} +{% ifreadable teams organisers%} + +{{record.organisers}} + +{% endifreadable %} +{% endifwritable %} +

+

diff --git a/resources/templates/auto/form-visits-Visit.html b/resources/templates/auto/form-visits-Visit.html index eea048a..80b3d61 100644 --- a/resources/templates/auto/form-visits-Visit.html +++ b/resources/templates/auto/form-visits-Visit.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-addresses-Addresses.html b/resources/templates/auto/list-addresses-Addresses.html index 67f54be..77d4307 100644 --- a/resources/templates/auto/list-addresses-Addresses.html +++ b/resources/templates/auto/list-addresses-Addresses.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-authorities-Authorities.html b/resources/templates/auto/list-authorities-Authorities.html new file mode 100644 index 0000000..161786d --- /dev/null +++ b/resources/templates/auto/list-authorities-Authorities.html @@ -0,0 +1,118 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +

+ + + + + + + + + + + + +{% for record in %records% %} + + + + +{% endfor %} + + + + + +
+id +
+ + + +
+{{ record.id }} + + +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 3208f2c..b9e5b76 100644 --- a/resources/templates/auto/list-canvassers-Canvassers.html +++ b/resources/templates/auto/list-canvassers-Canvassers.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-districts-Districts.html b/resources/templates/auto/list-districts-Districts.html index f7ba9a6..89c4394 100644 --- a/resources/templates/auto/list-districts-Districts.html +++ b/resources/templates/auto/list-districts-Districts.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-dwellings-Dwellings.html b/resources/templates/auto/list-dwellings-Dwellings.html index 308fa23..f5c31e5 100644 --- a/resources/templates/auto/list-dwellings-Dwellings.html +++ b/resources/templates/auto/list-dwellings-Dwellings.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-electors-Electors.html b/resources/templates/auto/list-electors-Electors.html index 0a512bf..95cf89d 100644 --- a/resources/templates/auto/list-electors-Electors.html +++ b/resources/templates/auto/list-electors-Electors.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-followupactions-Followupactions.html b/resources/templates/auto/list-followupactions-Followupactions.html index bd336e9..e3e271f 100644 --- a/resources/templates/auto/list-followupactions-Followupactions.html +++ b/resources/templates/auto/list-followupactions-Followupactions.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-followupmethods-Followupmethods.html b/resources/templates/auto/list-followupmethods-Followupmethods.html new file mode 100644 index 0000000..f717b8c --- /dev/null +++ b/resources/templates/auto/list-followupmethods-Followupmethods.html @@ -0,0 +1,118 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+ + + + + + + + + + + + +{% for record in %records% %} + + + + +{% endfor %} + + + + + +
+id +
+ + + +
+{{ record.id }} + + +View + +
+
+ +{% endblock %} +{% block foot %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/templates/auto/list-followuprequests-Followuprequests.html b/resources/templates/auto/list-followuprequests-Followuprequests.html new file mode 100644 index 0000000..8ddb65e --- /dev/null +++ b/resources/templates/auto/list-followuprequests-Followuprequests.html @@ -0,0 +1,154 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+ + + + + + + + + + + + + + + + + + + + +{% for record in %records% %} + + + + + + + + +{% endfor %} + + + + + +
+id + +elector_id + +visit_id + +issue_id + +method_id +
+ + + + + + + + + + + +
+{{ record.id }} + +{{ record.elector_id }} + +{{ record.visit_id }} + +{{ record.issue_id }} + +{{ record.method_id }} + + +View + +
+
+ +{% endblock %} +{% block foot %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/templates/auto/list-genders-Genders.html b/resources/templates/auto/list-genders-Genders.html new file mode 100644 index 0000000..7a4778a --- /dev/null +++ b/resources/templates/auto/list-genders-Genders.html @@ -0,0 +1,118 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+ + + + + + + + + + + + +{% for record in %records% %} + + + + +{% endfor %} + + + + + +
+id +
+ + + +
+{{ record.id }} + + +View + +
+
+ +{% endblock %} +{% block foot %} + + +{% endblock %} \ No newline at end of file diff --git a/resources/templates/auto/list-intentions-Intentions.html b/resources/templates/auto/list-intentions-Intentions.html new file mode 100644 index 0000000..45ecdec --- /dev/null +++ b/resources/templates/auto/list-intentions-Intentions.html @@ -0,0 +1,136 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+ + + + + + + + + + + + + + + + +{% for record in %records% %} + + + + + + +{% endfor %} + + + + + +
+visit_id + +elector_id + +option_id +
+ + + + + + + +
+{{ record.visit_id }} + +{{ record.elector_id }} + +{{ record.option_id }} + + +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 3eb2726..b5f2283 100644 --- a/resources/templates/auto/list-issues-Issues.html +++ b/resources/templates/auto/list-issues-Issues.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-options-Options.html b/resources/templates/auto/list-options-Options.html new file mode 100644 index 0000000..6ad9f1f --- /dev/null +++ b/resources/templates/auto/list-options-Options.html @@ -0,0 +1,118 @@ +{% extends "base.html" %} + +{% block head %} + + + + + + + + + + + + + +{{site-title}}: {{title}} + + +{% endblock %} + +{% block content %} +
+ + + + + + + + + + + + +{% for record in %records% %} + + + + +{% endfor %} + + + + + +
+id +
+ + + +
+{{ record.id }} + + +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 6fe67e3..62b00d7 100644 --- a/resources/templates/auto/list-roles-Roles.html +++ b/resources/templates/auto/list-roles-Roles.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-teams-Teams.html b/resources/templates/auto/list-teams-Teams.html index c456013..a18045b 100644 --- a/resources/templates/auto/list-teams-Teams.html +++ b/resources/templates/auto/list-teams-Teams.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-visits-Visits.html b/resources/templates/auto/list-visits-Visits.html index 0eed2f0..1807168 100644 --- a/resources/templates/auto/list-visits-Visits.html +++ b/resources/templates/auto/list-visits-Visits.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/src/clj/youyesyet/db/core.clj b/src/clj/youyesyet/db/core.clj index 6941257..49bbe06 100644 --- a/src/clj/youyesyet/db/core.clj +++ b/src/clj/youyesyet/db/core.clj @@ -5,8 +5,8 @@ [cheshire.core :refer [generate-string parse-string]] [clojure.java.jdbc :as jdbc] [conman.core :as conman] - [youyesyet.config :refer [env]] - [mount.core :refer [defstate]]) + [mount.core :refer [defstate]] + [youyesyet.config :refer [env]]) (:import org.postgresql.util.PGobject java.sql.Array clojure.lang.IPersistentMap diff --git a/src/clj/youyesyet/handler.clj b/src/clj/youyesyet/handler.clj index 5c3d962..909dea4 100644 --- a/src/clj/youyesyet/handler.clj +++ b/src/clj/youyesyet/handler.clj @@ -1,20 +1,19 @@ (ns ^{:doc "Handlers for starting and stopping the webapp." :author "Simon Brooke"} youyesyet.handler - (:require [compojure.core :refer [routes wrap-routes]] + (:require [clojure.tools.logging :as log] + [compojure.core :refer [routes wrap-routes]] + [compojure.route :as route] + [mount.core :as mount] + [youyesyet.config :refer [env]] [youyesyet.layout :refer [error-page]] + [youyesyet.middleware :as middleware] [youyesyet.routes.authenticated :refer [authenticated-routes]] [youyesyet.routes.home :refer [home-routes]] [youyesyet.routes.oauth :refer [oauth-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] - [youyesyet.middleware :as middleware] - [clojure.tools.logging :as log] - [youyesyet.db.core :as db] - [youyesyet.config :refer [env]])) + [youyesyet.env :refer [defaults]])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; @@ -82,5 +81,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 3781e1d..6fc5733 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 20180611T180322.460Z" + "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180614T175643.413Z" (:require [noir.response :as nresponse] [noir.util.route :as route] diff --git a/src/clj/youyesyet/routes/auto_json.clj b/src/clj/youyesyet/routes/auto_json.clj index 9426c90..6a5a5ef 100644 --- a/src/clj/youyesyet/routes/auto_json.clj +++ b/src/clj/youyesyet/routes/auto_json.clj @@ -1,6 +1,6 @@ (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" + "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180614T175642.456Z" (:require [noir.response :as nresponse] [noir.util.route :as route] @@ -24,13 +24,9 @@ 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! @@ -44,13 +40,9 @@ 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 @@ -65,13 +57,10 @@ get-gender get-intention get-issue - get-issueexpertise get-option get-role - get-rolemembership + get-role-by-name get-team - get-teammembership - get-teamorganisership get-visit list-addresses list-addresses-by-district @@ -101,23 +90,10 @@ 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 @@ -136,13 +112,9 @@ 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! @@ -153,12 +125,8 @@ update-followuprequest! update-intention! update-issue! - update-issueexpertise! update-role! - update-rolemembership! update-team! - update-teammembership! - update-teamorganisership! update-visit!) @@ -212,10 +180,6 @@ "/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 @@ -224,22 +188,10 @@ "/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 @@ -292,10 +244,6 @@ "/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 @@ -304,22 +252,10 @@ "/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 @@ -376,10 +312,6 @@ "/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 @@ -389,21 +321,13 @@ request (route/restricted (get-role request))) (POST - "/json/auto/get-rolemembership" + "/json/auto/get-role-by-name" request - (route/restricted (get-rolemembership request))) + (route/restricted (get-role-by-name 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 @@ -520,22 +444,6 @@ "/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 @@ -544,18 +452,6 @@ "/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 @@ -564,30 +460,6 @@ "/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 @@ -660,10 +532,6 @@ "/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 @@ -672,22 +540,10 @@ "/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 @@ -728,30 +584,14 @@ "/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 @@ -830,12 +670,6 @@ [{: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." @@ -848,30 +682,12 @@ [{: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." @@ -962,13 +778,6 @@ (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`: ``." @@ -983,13 +792,6 @@ (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`: ``." @@ -997,20 +799,6 @@ (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`: ``." @@ -1096,12 +884,6 @@ [{: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)`." @@ -1115,10 +897,10 @@ (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)`." + get-role-by-name + "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-rolemembership params))) + (do (db/get-role-by-name params))) (defn get-team @@ -1126,18 +908,6 @@ [{: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)`." @@ -1295,27 +1065,6 @@ [{: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)`." @@ -1328,22 +1077,6 @@ [{: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)`." @@ -1355,38 +1088,6 @@ [{: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)`." @@ -1491,12 +1192,6 @@ [{: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)`." @@ -1509,30 +1204,12 @@ [{: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)`." @@ -1602,13 +1279,6 @@ (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)`." @@ -1616,13 +1286,6 @@ (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)`." @@ -1630,20 +1293,6 @@ (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)`." diff --git a/youyesyet.adl.xml b/youyesyet.adl.xml index 4c9ae8c..c7237e1 100644 --- a/youyesyet.adl.xml +++ b/youyesyet.adl.xml @@ -56,7 +56,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 @@ -101,13 +101,19 @@ + default="Unknown" distinct="user">
+ + + + + + - + All genders which may be assigned to electors. @@ -116,6 +122,12 @@ + + + + + + All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live. @@ -124,12 +136,18 @@ - + - + + + + + + + Addresses of all buildings which contain dwellings. @@ -156,11 +174,46 @@ - + + + Locality indexing; see issue #44. Note that this property should be generated + automatically from the latitude and 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)))) + We'll use a trigger to insert this. I don't think it will ever appear in the user + interface; it's an implementation detail, not of interest to users. + + + + + + + + + + + + + + + + + + + + + + - -
+ + All visits made by canvassers to dwellings in which opinions were recorded. @@ -170,18 +223,24 @@ + entity="addresses" farkey="id" distinct="user"> - + - - + + But only in their immediate area. + + + + + + @@ -194,6 +253,12 @@ + + + + + + Issues believed to be of interest to electors, about which they may have questions. @@ -210,6 +275,12 @@ + + + + + + Link table. @@ -227,6 +298,16 @@ + + But only for intentions in their immediate locality. + + + + + Can see all recorded intentions across the whole of Scotland. + + + Primary users of the system: those actually interviewing electors. @@ -261,13 +342,13 @@ - + But only their own record - + But only canvassers in their own team. @@ -275,6 +356,14 @@ + + But should only be able to edit their own record. + + + + + + Requests for a followup with an issue expert @@ -284,15 +373,15 @@ + farkey="id" distinct="user"> + farkey="id" distinct="user"> + farkey="id" distinct="user"> - - - 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. @@ -320,7 +404,7 @@ - + @@ -328,6 +412,12 @@ + + + + + + @@ -348,13 +438,19 @@ + + + - + But only their own group(s) + + + All groups @@ -362,7 +458,7 @@ - Electoral districts + Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps. @@ -375,17 +471,12 @@ - - - Link table - - - - - - + + + + + + Actions taken on followup requests. @@ -402,37 +493,25 @@ farkey="id"> - + - + - + + + But only for electors in their immediate vicinity + - - - - - Link table - - - - - - - - - + + Options in the election or referendum being canvassed on @@ -443,17 +522,12 @@ - - - Link table - - - - - - + + + + + + @@ -463,5 +537,11 @@ + + + + + + diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml index e907dc8..c269c0f 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 @@ -110,36 +110,36 @@ - + + + + + + +
- + + All genders which may be assigned to electors. - - - - - - - - - - - - -
- - - -
+ +
+ + + + + +
- - Link table - - - - - Auto-generated abstract primary key - - - - - - - - - - - - - - - - + + + + + + - Electoral districts + Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps. @@ -471,33 +529,12 @@
-
- - - Link table - - - - - Auto-generated abstract primary key - - - - - - - - - - - - - - - - + + + + + + - - Link table - - - - - Auto-generated abstract primary key - - - - - - - - - - - - - - - - - - - + + - - Link table - - - - - Auto-generated abstract primary key - - - - - - - - - - - - - - - - + + + + + +