feat: Complete PL24 architecture overhaul with email & auth improvements
## PL24 Integration Rewrite - Add dual architecture support: P5 Modern (JSON API) + Legacy (HTML scraping) - New services: factory, session, fetch, html-parser, legacy-scraper - Add NHTSA WMI data for accurate brand detection - Brand-specific parsers for VW, Mercedes, BMW, Audi, Porsche, Ford, etc. - Add 254 schema images for parts diagrams ## Authentication & Security - Add PasswordResetToken database model with proper expiration - Implement dual persistence (Redis + DB) for password reset tokens - Add email enumeration protection ## Email Module - New EmailService for password reset emails - Configurable SMTP settings ## Database Schema - Add Vehicle fields: equipment, interiorCode, productionDate, salesType - Add Part.hotspotId for schema hotspot linking - Add SchemaPic.hotspots JSON field - Add VehicleCategory.subGroupsJson for subgroup data ## Frontend - Improve auth pages (login, register, forgot-password) - Enhance vehicle detail and categories pages Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -396,11 +396,41 @@ pm2 logs # View logs
|
||||
| **Payments** | `payments.module.ts`, `payments.controller.ts`, `payments.service.ts`, `iyzico.service.ts`, DTOs |
|
||||
|
||||
#### Integrations
|
||||
|
||||
##### PartsLink24 (PL24) Integration
|
||||
| File | Description |
|
||||
|------|-------------|
|
||||
| `integrations/vin-api/vin-api.service.ts` | External VIN API client |
|
||||
| `integrations/vin-api/vin-api.types.ts` | API response types |
|
||||
| `integrations/vin-api/vin-api.mapper.ts` | Response transformation |
|
||||
| `integrations/pl24/pl24.module.ts` | Module configuration |
|
||||
| `integrations/pl24/pl24.service.ts` | Main VIN/parts API service |
|
||||
| `integrations/pl24/pl24-auth.service.ts` | JWT authentication with PL24 |
|
||||
| `integrations/pl24/pl24-db.service.ts` | Database operations for PL24 data |
|
||||
| `integrations/pl24/pl24.types.ts` | Type definitions |
|
||||
|
||||
**PL24 Features:**
|
||||
- JWT-based API authentication per service
|
||||
- VIN decode returns vehicle + categories
|
||||
- Parts fetched on-demand (user clicks category)
|
||||
- Schema images downloaded and cached locally
|
||||
- Hotspot coordinates for interactive diagrams
|
||||
|
||||
**Supported PL24 Brands:**
|
||||
VW, Audi, Skoda, SEAT, Cupra, BMW, MINI, Mercedes-Benz, Porsche, Toyota, Lexus, Renault, Dacia, Jaguar, Land Rover
|
||||
|
||||
##### EMEX Integration (Scraping)
|
||||
| File | Description |
|
||||
|------|-------------|
|
||||
| `integrations/emex/emex.module.ts` | Module configuration |
|
||||
| `integrations/emex/emex.service.ts` | VIN decode service |
|
||||
| `integrations/emex/emex.mapper.ts` | Response mapping |
|
||||
| `integrations/emex/emex.types.ts` | Type definitions |
|
||||
|
||||
**EMEX Features:**
|
||||
- Puppeteer-based web scraping (headless browser)
|
||||
- Parts fetched on-demand when user clicks category
|
||||
- Category URL caching for subsequent requests
|
||||
|
||||
**Supported EMEX Brands:**
|
||||
BMW, Mercedes-Benz, Audi, Volkswagen, Renault, Peugeot, Fiat, Alfa Romeo, Ford, Toyota, Honda, Hyundai, Kia
|
||||
|
||||
### Web Source Files
|
||||
|
||||
@@ -437,5 +467,86 @@ pm2 logs # View logs
|
||||
|
||||
---
|
||||
|
||||
*Last Updated: 2026-01-16*
|
||||
*Generated by Claude Code*
|
||||
---
|
||||
|
||||
## VIN Data Flow
|
||||
|
||||
### VIN Decode Flow
|
||||
|
||||
```
|
||||
Frontend Backend Integration
|
||||
│ │ │
|
||||
│ POST /vehicles/decode │ │
|
||||
│──────────────────────────>│ │
|
||||
│ │ Determine provider │
|
||||
│ │ (PL24 or EMEX by WMI) │
|
||||
│ │───────────────────────────>│
|
||||
│ │ │ Decode VIN
|
||||
│ │<───────────────────────────│
|
||||
│ │ Vehicle + Categories │
|
||||
│ │ │
|
||||
│ │ Save to database │
|
||||
│<──────────────────────────│ │
|
||||
│ Vehicle response │ │
|
||||
```
|
||||
|
||||
### Parts Loading Flow (On-Demand)
|
||||
|
||||
```
|
||||
Frontend Backend Integration
|
||||
│ │ │
|
||||
│ GET /vehicles/:vin/ │ │
|
||||
│ categories/:id/parts │ │
|
||||
│──────────────────────────>│ │
|
||||
│ │ Check DB for parts │
|
||||
│ │ │
|
||||
│ │ If empty: │
|
||||
│ │───────────────────────────>│
|
||||
│ │ │ Fetch parts
|
||||
│ │ │ + schema image
|
||||
│ │<───────────────────────────│
|
||||
│ │ Parts + Schema + Hotspots │
|
||||
│ │ │
|
||||
│ │ Save to database │
|
||||
│<──────────────────────────│ │
|
||||
│ Parts with interactive │ │
|
||||
│ schema diagram │ │
|
||||
```
|
||||
|
||||
### Schema Image System
|
||||
|
||||
The parts page features an interactive schema diagram:
|
||||
|
||||
1. **Schema Image Display**
|
||||
- Downloaded from PL24 and stored locally at `apps/api/public/images/schemas/`
|
||||
- Served via `/api/static/images/schemas/`
|
||||
|
||||
2. **Hotspots (Clickable Regions)**
|
||||
- Extracted from PL24 API
|
||||
- Stored as JSON: `[{key: "1A", areas: [{left, top, width, height}]}]`
|
||||
- Scaled to match displayed image size
|
||||
|
||||
3. **Part-Hotspot Linking**
|
||||
- Parts have `hotspotId` field (e.g., "1A", "2")
|
||||
- Clicking hotspot scrolls to matching part
|
||||
- Hovering part highlights hotspot on schema
|
||||
|
||||
---
|
||||
|
||||
## PL24 Normalized Database Schema
|
||||
|
||||
For data deduplication, PL24 data uses a normalized structure:
|
||||
|
||||
| Table | Purpose |
|
||||
|-------|---------|
|
||||
| `PL24Catalog` | Service catalogs (VW, Audi, etc.) |
|
||||
| `PL24Vehicle` | Vehicle models (deduplicated) |
|
||||
| `PL24VehicleVin` | VIN to vehicle mapping |
|
||||
| `PL24PartGroup` | Category hierarchy |
|
||||
| `PL24Part` | Parts (deduplicated across vehicles) |
|
||||
| `PL24SchemaPic` | Schema images (deduplicated) |
|
||||
|
||||
---
|
||||
|
||||
*Last Updated: 2026-01-26*
|
||||
*Generated with SuperClaude /sc:index*
|
||||
|
||||
Reference in New Issue
Block a user