WITH selected_neighbourhood AS (
SELECT id
FROM locations
WHERE neighbourhood_id = $1
LIMIT 1
), box_numbers AS (
SELECT b.id AS building_id, ARRAY_AGG(bb.box_no ORDER BY bb.box_no) AS box_numbers
FROM volunteer_counts vc
JOIN selected_neighbourhood sn ON vc.location_id = sn.id
LEFT JOIN buildings b ON vc.building_id = b.id
LEFT JOIN ballot_boxes bb ON b.id = bb.building_id
GROUP BY b.id
)
SELECT b.name AS building_name, bn.box_numbers
FROM buildings b
LEFT JOIN box_numbers bn ON b.id = bn.building_id;
What was done ?
location_id
involunteer_counts
table. Because there can be more than one building in a neighborhood.Notes
lastUpdateTime
data was requested, but we do not keep any time data in the database.I honestly don't know how to generate the
intensity
data.Endpoint
URL:
/feed/<neighborhood_id>
What kind of response is coming?
Query
The SQL query this endpoint uses:
Closes #19