feat(manufacturers): detail page with MPN-level insights
Adds /manufacturers/:id with vendor-wide KPIs, top MPNs by units, failures by MPN, category mix, past-EOL exposure, and a filtered PartModels table. Wires upstream links from PartDetail and PartModelDetail so the manufacturer name is a navigable anchor. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
CreateManufacturerRequest,
|
||||
ManufacturerInsights,
|
||||
UpdateManufacturerRequest,
|
||||
} from '@vector/shared';
|
||||
import { api } from './client.js';
|
||||
@@ -15,6 +16,16 @@ export function listManufacturers(filters: ManufacturerListFilters = {}) {
|
||||
return getList<Manufacturer>('/manufacturers', filters);
|
||||
}
|
||||
|
||||
export async function getManufacturer(id: string): Promise<Manufacturer> {
|
||||
const res = await api.get<Manufacturer>(`/manufacturers/${id}`);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function getManufacturerInsights(id: string): Promise<ManufacturerInsights> {
|
||||
const res = await api.get<ManufacturerInsights>(`/manufacturers/${id}/insights`);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function createManufacturer(input: CreateManufacturerRequest): Promise<Manufacturer> {
|
||||
const res = await api.post<Manufacturer>('/manufacturers', input);
|
||||
return res.data;
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface Manufacturer {
|
||||
name: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
_count?: { parts: number; partModels: number };
|
||||
}
|
||||
|
||||
export interface PartModel {
|
||||
|
||||
@@ -20,6 +20,7 @@ export const queryKeys = {
|
||||
list: (filters?: Record<string, unknown>) =>
|
||||
[...queryKeys.manufacturers.all, 'list', filters ?? {}] as const,
|
||||
detail: (id: string) => [...queryKeys.manufacturers.all, 'detail', id] as const,
|
||||
insights: (id: string) => [...queryKeys.manufacturers.all, 'insights', id] as const,
|
||||
},
|
||||
sites: {
|
||||
all: ['sites'] as const,
|
||||
|
||||
Reference in New Issue
Block a user