Skip to content

feat: add bulk delete all measurements for a device#858

Open
JerryVincent wants to merge 3 commits intodevfrom
feat/deleteMeasurements_at_Once
Open

feat: add bulk delete all measurements for a device#858
JerryVincent wants to merge 3 commits intodevfrom
feat/deleteMeasurements_at_Once

Conversation

@JerryVincent
Copy link
Collaborator

Type of Change

  • Dependency upgrade
  • Bug fix (non-breaking change)
  • Breaking change
    • e.g. a fixed bug or new feature that may break something else
  • New feature
  • Code quality improvements
    • e.g. refactoring, documentation, tests, tooling, ...

Implementation

Added a new Delete Measurements page under the device settings sidebar (/device/:deviceId/edit/delete-measurements). On the backend, deleteMeasurementsForDevice was added to measurement.server.ts — it uses a Drizzle subquery to fetch all sensor IDs belonging to the device and deletes their measurements in a single database operation. The route action follows the same auth pattern as the device deletion page: session-based ownership check plus password re-verification via verifyLogin before any data is touched. The action returns the deleted row count so the UI can distinguish between a successful deletion and a no-op (device had no measurements), showing a green success banner or a yellow warning respectively. EN and DE translations are included.

Checklist

  • I gave this pull request a meaningful title
  • My pull request is targeting the dev branch
  • I have added documentation to my code
  • I have deleted code that I have commented out

Additional Information

Previously, clearing a device's measurement history required deleting
each sensor's data individually. Users can now delete all measurements
across all sensors at once from the device settings sidebar, with
password confirmation and feedback for both success and empty states.
@github-actions
Copy link

github-actions bot commented Mar 25, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 69.47% 1714 / 2467
🔵 Statements 67.75% 1786 / 2636
🔵 Functions 69.21% 353 / 510
🔵 Branches 56.63% 935 / 1651
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
app/models/measurement.server.ts 50% 30% 69.23% 49.15% 32-157, 182, 183, 193-197, 293-300
Generated in workflow #2317 for commit f15b323 by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide function for deleting measurements of all sensors/phenomena at once

1 participant