Skip to content

feat: vet directory, GDPR/CCPA, insurance integration, and Elasticsearch search#427

Merged
success-OG merged 1 commit into
DogStark:mainfrom
miss-yusrah:feat/GDPR
May 28, 2026
Merged

feat: vet directory, GDPR/CCPA, insurance integration, and Elasticsearch search#427
success-OG merged 1 commit into
DogStark:mainfrom
miss-yusrah:feat/GDPR

Conversation

@miss-yusrah
Copy link
Copy Markdown
Contributor

@miss-yusrah miss-yusrah commented May 27, 2026

PR Description

closes #321
closes #324
closes #325
closes #327

Summary

Implements four features for PetChain: a searchable vet directory with real-time messaging, GDPR/CCPA compliance tools, pet insurance integration, and full-text Elasticsearch
search.


Changes

Task 1 — Vet Directory with Search & In-App Messaging

Backend

  • backend/migrations/006_vet_directory_messaging.sqlvet_profiles table with PostGIS GEOGRAPHY column + spatial index; messages table with conversation index
  • backend/services/messagingService.ts — WebSocket server (/ws/messages), in-memory message store, real-time delivery to online recipients
  • backend/server/routes/vets.tsGET /api/vets (filter by radius/specialty/availability using Haversine), GET /api/vets/:id, POST /api/vets, GET/POST /api/vets/messages/:vetId with pagination

Frontend

  • src/services/vetService.ts — typed API wrappers for vet search and messaging
  • src/screens/VetDirectoryScreen.tsx — three-screen flow: directory list → vet profile → real-time chat UI

Task 2 — GDPR/CCPA Compliance

Backend

  • backend/migrations/007_gdpr_ccpa.sqlconsent_logs (timestamped audit trail) and data_deletion_requests tables
  • backend/services/dataExportService.tsexportUserData (strips passwordHash), eraseUserData (hard-deletes all PII), logConsent / getConsentHistory
  • backend/server/routes/privacy.tsGET /export (JSON download), GET/POST /consent, GET /consent/history, DELETE /erase

Frontend

  • src/screens/PrivacyDashboardScreen.tsx — per-category consent toggles (necessary locked), save preferences, export data, right-to-erasure with confirmation dialog

Task 3 — Pet Insurance Integration

Backend

  • backend/migrations/008_insurance.sqlinsurance_policies and insurance_claims tables
  • backend/services/insuranceService.ts — mock OAuth code exchange for Trupanion/Nationwide, claim submission with async status progression, claim history
  • backend/server/routes/insurance.tsGET /policies, POST /connect, GET/POST /claims, GET /claims/:id

Frontend

  • src/services/claimsService.ts — typed API wrappers
  • src/screens/InsuranceScreen.tsx — tabbed policies/claims view, connect provider flow, claim submission form with policy selector

Task 4 — Elasticsearch Full-Text Search

Backend

  • backend/services/searchService.ts@elastic/elasticsearch client, search() with fuzzy multi-match, field filters, result highlighting, indexDocument /
    deleteDocument for CDC sync, ensureIndices for bootstrap
  • backend/server/routes/search.tsGET /api/search?q=&index=&from=&size=&<field>=<value> with 100-result cap

Frontend

  • src/screens/SearchScreen.tsx — search-as-you-type with 350 ms debounce, highlight display, result count, clear button

Wiring

  • backend/server/app.ts — registered /vets, /privacy, /insurance, /search routes
  • src/navigation/types.ts — added VetDirectory, PrivacyDashboard, Insurance, Search to PetStackParamList

Testing

  • WebSocket message delivery can be load-tested by connecting multiple clients to /ws/messages?userId=<id>
  • Insurance claim flow covered by mock provider (use provider: "mock" with any code string)
  • Elasticsearch tests: run ensureIndices() then index sample docs and verify fuzzy search returns highlighted hits
  • GDPR erasure: verify all user-owned records are removed after DELETE /api/privacy/erase

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

@miss-yusrah 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

@success-OG success-OG merged commit 5ef1060 into DogStark:main May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants