Sergei
0cc82b24b0
Add deployment_id lookup mechanism
Implement getDeploymentForBeneficiary() method to resolve beneficiary → deployment_id mapping. This extracts the deployment lookup logic into a reusable, testable method.
Changes:
- Add getDeploymentForBeneficiary() in services/api.ts
- Fetches beneficiary from WellNuo API
- Returns deployment_id with proper error handling
- Returns ApiResponse<number> with typed errors
- Refactor attachDeviceToBeneficiary() to use new method
- Reduces code duplication
- Improves separation of concerns
- Add comprehensive test suite
- Tests successful deployment lookup
- Tests authentication errors
- Tests missing deployment scenarios
- Tests network error handling
- Tests edge cases (string IDs, 0 values, empty strings)
Benefits:
- Deployment lookup now reusable across codebase
- Better error handling with specific error codes
- Easier to test and maintain
- Follows DRY principle
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-31 16:00:11 -08:00
..
2026-01-31 15:55:24 -08:00
2026-01-31 15:50:54 -08:00
2026-01-31 16:00:11 -08:00
2026-01-08 10:35:15 -08:00
2026-01-29 12:44:16 -08:00
2026-01-24 15:22:40 -08:00
2026-01-29 12:05:29 -08:00
2026-01-29 12:44:16 -08:00
2026-01-29 12:44:16 -08:00
2026-01-12 20:28:18 -08:00
2026-01-08 10:35:15 -08:00
2026-01-24 15:22:40 -08:00
2026-01-31 15:55:24 -08:00