feat: add occupancy module with controller, service, and related DTOs for heat map data retrieval

This commit is contained in:
faris Aljohari
2025-05-12 02:15:57 +03:00
parent c0a6e9ab63
commit 7ec4171e1a
25 changed files with 270 additions and 9 deletions
@@ -1,12 +1,15 @@
WITH params AS (
SELECT
$1::uuid AS space_id,
TO_DATE(NULLIF($2, ''), 'YYYY-MM') AS event_month
TO_DATE(NULLIF($2, ''), 'YYYY') AS event_year
)
select psdsd.*
from public."presence-sensor-daily-space-detection" psdsd
SELECT psdsd.*
FROM public."presence-sensor-daily-space-detection" psdsd
JOIN params P ON true
where psdsd.space_uuid = P.space_id
AND (P.event_month IS NULL OR TO_CHAR(psdsd.event_date, 'YYYY-MM') = TO_CHAR(P.event_month, 'YYYY-MM'))
WHERE psdsd.space_uuid = P.space_id
AND (
P.event_year IS NULL
OR TO_CHAR(psdsd.event_date, 'YYYY') = TO_CHAR(P.event_year, 'YYYY')
)
ORDER BY space_uuid, event_date
@@ -1,7 +1,7 @@
WITH params AS (
SELECT
TO_DATE(NULLIF($2, ''), 'YYYY-MM-DD') AS event_date,
$4::uuid AS space_id
TO_DATE(NULLIF($1, ''), 'YYYY-MM-DD') AS event_date,
$2::uuid AS space_id
),
device_logs AS (