mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
feat(measurements): value-range filter on the management list
Add an optional numeric value-range filter to the measurement list:
readings whose `value` falls within `[valueMin, valueMax]`, either bound
omittable for an open-ended range. Server-authoritative — both bounds are
parsed on `listMeasurementsSchema` (coerced from the query string), an
inverted `valueMin > valueMax` returns 422, and the bounds thread into the
Prisma `where` as a `value: { gte, lte }` range on the raw per-sample list.
The filter rides a new `FilterBarNumberRange` pill that mirrors the existing
date-range control, hidden for the day-grouped and sleep-night types where
the painted value is a synthesised total rather than a stored reading.
This commit is contained in:
1 parent
8920a35d38
commit
cc89695cbd
14 files changed
+286
-4
No files matched your search
@@ -99,6 +99,8 @@ export const GET = apiHandler(async (request: NextRequest) => {
|
||||
aggregate,
|
||||
source,
|
||||
sourceEq,
|
||||
valueMin,
|
||||
valueMax,
|
||||
groupBy,
|
||||
dayKey,
|
||||
} = parsed.data;
|
||||
@@ -116,6 +118,16 @@ export const GET = apiHandler(async (request: NextRequest) => {
|
||||
// `source=rollup` opt-in above (which selects the rollup read tier);
|
||||
// `sourceEq` narrows the plain list to one ingest source.
|
||||
...(sourceEq && { source: sourceEq }),
|
||||
// v1.18.5 — value-range filter (backlog G). Open-ended on either side;
|
||||
// the validator has already rejected an inverted `valueMin > valueMax`.
|
||||
...(valueMin != null || valueMax != null
|
||||
? {
|
||||
value: {
|
||||
...(valueMin != null && { gte: valueMin }),
|
||||
...(valueMax != null && { lte: valueMax }),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(from || to
|
||||
? {
|
||||
measuredAt: {
|
||||
|
||||
Reference in new issue
Block a user