Skip to content

Buildings

Josef Gabrielsson edited this page Jul 8, 2021 · 11 revisions

Buildings

API

URL: https://gqfktgknxmguhxgkajat.supabase.co

Key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyMDc2MTg0NCwiZXhwIjoxOTM2MzM3ODQ0fQ.xEa_GuNypFdHSdQVLCd0beoL_v8jhWKjSTypX6kn-sg

Policies

create policy "Public buildings are viewable by everyone." on buildings for select using (true);

Queries

All buildings

https://gqfktgknxmguhxgkajat.supabase.co/rest/v1/buildings

Stored Procedures

Buildings

https://gqfktgknxmguhxgkajat.supabase.co/rest/v1/rpc/buildings

  • Churches
  • Schools

CREATE OR REPLACE FUNCTION buildings()
RETURNS TABLE(church bigint, dead bigint) AS $$
BEGIN
  RETURN QUERY
  SELECT
  SUM(1) FILTER (WHERE church IS NOT NULL) AS churches,
  SUM(1) FILTER (WHERE school IS NOT NULL) AS schools
  FROM buildings;
END
$$ LANGUAGE plpgsql;

Persons

Clone this wiki locally