wip: currently rewriting the project as a full stack application
tangled.org/kacaii.dev/sigo
gleam
1create or replace view vw_count_active_occurrences as
2select count(oc.id) as count
3from public.occurrence as oc
4where oc.resolved_at is null;
5
6-----------------------------------------------------
7create or replace view vw_count_recent_occurrences as
8select count(oc.id) as count
9from public.occurrence as oc
10where oc.created_at >= (now() - '1 day'::interval);
11
12----------------------------------------------------
13create or replace view vw_count_total_occurrences as
14select count(oc.id) as count
15from public.occurrence as oc;
16
17------------------------------------------------------
18create or replace view vw_count_active_brigades as
19select count(id)
20from public.brigade
21where is_active = true;