fix(spool): Add remaining_weight filter for low stock detection
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled

- Add remaining_weight_lt and remaining_weight_gt filter params to spool API
- Filter uses computed formula: initial_weight - used_weight (falls back to filament.weight)
- Update home page to use queryParams instead of Refine filters
- Fixes low stock badge count on dashboard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-15 23:44:20 -06:00
parent 41d07f069b
commit 88747307e5
3 changed files with 27 additions and 8 deletions

View File

@@ -268,6 +268,20 @@ async def find(
Optional[bool],
Query(title="Needs Weighing", description="Filter by spools that need manual weigh-in."),
] = None,
remaining_weight_lt: Annotated[
Optional[float],
Query(
title="Remaining Weight Less Than",
description="Filter by spools with remaining weight (in grams) less than this value.",
),
] = None,
remaining_weight_gt: Annotated[
Optional[float],
Query(
title="Remaining Weight Greater Than",
description="Filter by spools with remaining weight (in grams) greater than this value.",
),
] = None,
sort: Annotated[
Optional[str],
Query(
@@ -313,6 +327,8 @@ async def find(
lot_nr=lot_nr,
allow_archived=allow_archived,
needs_weighing=needs_weighing,
remaining_weight_lt=remaining_weight_lt,
remaining_weight_gt=remaining_weight_gt,
sort_by=sort_by,
limit=limit,
offset=offset,