Skip to content

feat: GET/DELETE /api/meters/:id with admin auth (#269)#454

Merged
AnnabelJoe merged 1 commit into
AnnabelJoe:mainfrom
ladinoraa:issue-269-meter-key-management
Jun 4, 2026
Merged

feat: GET/DELETE /api/meters/:id with admin auth (#269)#454
AnnabelJoe merged 1 commit into
AnnabelJoe:mainfrom
ladinoraa:issue-269-meter-key-management

Conversation

@ladinoraa

Copy link
Copy Markdown
Contributor

Summary

Closes #269

Adds the missing GET and DELETE endpoints for individual meter management, completing the meter device registration API.

Changes

  • api/meters/[id]/route.ts — GET retrieves meter info (404 if missing); DELETE soft-deactivates (active=false), keeping historical readings intact
  • Both endpoints require operator JWT via requireAuth()
  • api/v1/meters/[id]/route.ts — v1 re-export
  • route.test.ts — 4 unit tests covering 200/404 for both operations

Acceptance criteria

  • POST /api/meters — register meter with public key (existing)
  • GET /api/meters/:id — retrieve meter info
  • DELETE /api/meters/:id — deactivate a meter
  • Admin authentication required for all endpoints
  • Public key stored and validated on registration

- GET /api/meters/:id — retrieve meter info (requires operator JWT)
- DELETE /api/meters/:id — deactivate a meter (soft-delete via active=false)
- Admin authentication required via requireAuth() for both endpoints
- Public key stored/validated on registration (existing POST /api/meters)
- v1 re-export wired up
- Unit tests covering 200/404 for both endpoints

Closes AnnabelJoe#269
@drips-wave

drips-wave Bot commented Jun 4, 2026

Copy link
Copy Markdown

@ladinoraa Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@AnnabelJoe AnnabelJoe merged commit 16f4d95 into AnnabelJoe:main Jun 4, 2026
8 of 16 checks passed
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.16.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add meter device registration and key management API

2 participants