diff options
| author | batsumaru <> | 2026-10-16 15:36:40 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-10-16 15:36:40 +0900 |
| commit | 289cdfd01ec2dda208de3cd67313c57133c1f092 (patch) | |
| tree | fbd56d052877776f333af7690b2b804ed98f9ef7 /src/handlers.rs | |
| parent | 7afd3da7b870fc56e54d04b131c1caf975a30f2c (diff) | |
Add metric type filtering
Diffstat (limited to 'src/handlers.rs')
| -rw-r--r-- | src/handlers.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/handlers.rs b/src/handlers.rs index 3c38724..5d31600 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -41,6 +41,7 @@ pub async fn list_measurements( SELECT id, measured_at, metric_type, value, unit FROM measurement WHERE ($1::timestamptz IS NULL OR measured_at >= $1) AND ($2::timestamptz IS NULL OR measured_at < $2) + AND ($5::metric_type IS NULL OR metric_type = $5) ORDER BY CASE WHEN $4 THEN measured_at END DESC, measured_at ASC LIMIT $3 @@ -48,7 +49,8 @@ pub async fn list_measurements( query.from, query.to, limit, - matches!(query.order, Order::Desc) + matches!(query.order, Order::Desc), + query.metric_type ) .fetch_all(&pool) .await?; |
