feat: add parts catalogs integration, catalog prefetch worker, and vehicle select modal
Integrate external parts catalogs API with auth service, add BullMQ-based catalog prefetch worker for background data caching, expand vehicles service with shared vehicle support, and add vehicle select modal to frontend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,17 +7,6 @@ export interface TransformedResponse<T> {
|
||||
meta?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
function stripSource(data: unknown): unknown {
|
||||
if (Array.isArray(data)) return data.map(stripSource);
|
||||
if (data && typeof data === "object" && !(data instanceof Date)) {
|
||||
const { source, ...rest } = data as Record<string, unknown>;
|
||||
return Object.fromEntries(
|
||||
Object.entries(rest).map(([k, v]) => [k, stripSource(v)]),
|
||||
);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class TransformInterceptor<T> implements NestInterceptor<T, TransformedResponse<T>> {
|
||||
intercept(
|
||||
@@ -28,21 +17,21 @@ export class TransformInterceptor<T> implements NestInterceptor<T, TransformedRe
|
||||
map((data) => {
|
||||
// If already wrapped, pass through
|
||||
if (data && typeof data === "object" && "success" in data) {
|
||||
return stripSource(data) as TransformedResponse<T>;
|
||||
return data as TransformedResponse<T>;
|
||||
}
|
||||
|
||||
// Handle pagination response
|
||||
if (data && typeof data === "object" && "items" in data && "meta" in data) {
|
||||
return {
|
||||
success: true,
|
||||
data: stripSource(data.items),
|
||||
data: data.items,
|
||||
meta: data.meta,
|
||||
} as TransformedResponse<T>;
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: stripSource(data),
|
||||
data,
|
||||
} as TransformedResponse<T>;
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user