feat(api): add VW commercial vehicle support, fix BOM leaf category handling
Add WV1/WV2/WV3 WMI codes for Volkswagen commercial vehicles (Ticari) mapped to vn_parts service. Skip BOM links in category traversal since they are leaf categories returning parts, not subgroups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -107,6 +107,11 @@ export class CategoriesService {
|
||||
return [];
|
||||
}
|
||||
|
||||
// BOM links are leaf categories — they return parts, not subgroups
|
||||
if (linkPath.includes("/bom/")) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const subGroups = await this.pl24Service.fetchSubGroupsByPath(
|
||||
linkPath,
|
||||
catalogInfo.serviceName,
|
||||
|
||||
@@ -109,5 +109,13 @@ describe("CorgiService", () => {
|
||||
expect(result!.wmi).toBe("3VW");
|
||||
expect(result!.isKnown).toBe(true);
|
||||
});
|
||||
|
||||
it("should decode a VW Commercial VIN correctly", () => {
|
||||
const result = service.decodeVin("WV2ZZZ2KZ5X071795");
|
||||
expect(result).not.toBeNull();
|
||||
expect(result!.brandName).toBe("Volkswagen");
|
||||
expect(result!.wmi).toBe("WV2");
|
||||
expect(result!.isKnown).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ const WMI_DATABASE: Record<string, string> = {
|
||||
WAU: "Audi", WUA: "Audi",
|
||||
// Volkswagen
|
||||
WVW: "Volkswagen", WVG: "Volkswagen", "3VW": "Volkswagen",
|
||||
WV1: "Volkswagen", WV2: "Volkswagen", WV3: "Volkswagen",
|
||||
// Toyota
|
||||
JTD: "Toyota", JTE: "Toyota", JTN: "Toyota", "2T1": "Toyota", "4T1": "Toyota",
|
||||
// Fiat
|
||||
|
||||
@@ -322,6 +322,11 @@ export const PL24_WMI_SERVICE_MAP: Record<string, string> = {
|
||||
"3VW": "vw_parts",
|
||||
"9BW": "vw_parts",
|
||||
|
||||
// Volkswagen Ticari (Commercial Vehicles / Nutzfahrzeuge)
|
||||
WV1: "vn_parts",
|
||||
WV2: "vn_parts",
|
||||
WV3: "vn_parts",
|
||||
|
||||
// Audi
|
||||
WAU: "audi_parts",
|
||||
TRU: "audi_parts",
|
||||
|
||||
Reference in New Issue
Block a user