feat: Rewire vehicles controller to use OCR VIN decode (#223) #226

Closed
opened 2026-02-19 03:19:38 +00:00 by egullickson · 0 comments
Owner

Relates to #223

Scope

Replace NHTSA client usage in the vehicles controller and service with the OCR proxy, and update cache logic.

Changes

  • Replace NHTSAClient with OcrClient in vehicles.controller.ts
  • Move VIN validation (regex) into controller (was in NHTSAClient)
  • Move cache logic (getCached/saveToCache) from NHTSAClient into vehicles service or controller
  • Refactor mapNHTSAResponse() to mapVinDecodeResponse() - takes Gemini response, does dropdown matching
  • Update vin_cache raw_data to store Gemini response format
  • Add migration 007_truncate_vin_cache.sql to clear stale NHTSA-format cache entries
  • Update error messages from NHTSA references to OCR service references

Acceptance Criteria

  • POST /api/vehicles/decode-vin routes through OCR service
  • VIN cache works with Gemini response format
  • Dropdown matching (year/make/model/trim/engine/transmission) preserved
  • Tier gating unchanged (Pro/Enterprise)
  • Error handling for OCR service failures
Relates to #223 ## Scope Replace NHTSA client usage in the vehicles controller and service with the OCR proxy, and update cache logic. ### Changes - Replace `NHTSAClient` with `OcrClient` in `vehicles.controller.ts` - Move VIN validation (regex) into controller (was in NHTSAClient) - Move cache logic (getCached/saveToCache) from NHTSAClient into vehicles service or controller - Refactor `mapNHTSAResponse()` to `mapVinDecodeResponse()` - takes Gemini response, does dropdown matching - Update `vin_cache` raw_data to store Gemini response format - Add migration `007_truncate_vin_cache.sql` to clear stale NHTSA-format cache entries - Update error messages from NHTSA references to OCR service references ### Acceptance Criteria - [ ] `POST /api/vehicles/decode-vin` routes through OCR service - [ ] VIN cache works with Gemini response format - [ ] Dropdown matching (year/make/model/trim/engine/transmission) preserved - [ ] Tier gating unchanged (Pro/Enterprise) - [ ] Error handling for OCR service failures
egullickson added the
status
backlog
type
feature
labels 2026-02-19 03:20:04 +00:00
egullickson added
status
done
and removed
status
backlog
labels 2026-02-20 15:04:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#226