diff options
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?; |
