Homepage Redesign
This commit is contained in:
@@ -161,38 +161,6 @@ export class VehiclesRepository {
|
||||
return (result.rowCount ?? 0) > 0;
|
||||
}
|
||||
|
||||
// Cache VIN decode results
|
||||
async cacheVINDecode(vin: string, data: any): Promise<void> {
|
||||
const query = `
|
||||
INSERT INTO vin_cache (vin, make, model, year, engine_type, body_type, raw_data)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
ON CONFLICT (vin) DO UPDATE
|
||||
SET make = $2, model = $3, year = $4,
|
||||
engine_type = $5, body_type = $6, raw_data = $7,
|
||||
cached_at = NOW()
|
||||
`;
|
||||
|
||||
await this.pool.query(query, [
|
||||
vin,
|
||||
data.make,
|
||||
data.model,
|
||||
data.year,
|
||||
data.engineType,
|
||||
data.bodyType,
|
||||
JSON.stringify(data.rawData)
|
||||
]);
|
||||
}
|
||||
|
||||
async getVINFromCache(vin: string): Promise<any | null> {
|
||||
const query = 'SELECT * FROM vin_cache WHERE vin = $1';
|
||||
const result = await this.pool.query(query, [vin]);
|
||||
|
||||
if (result.rows.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return result.rows[0];
|
||||
}
|
||||
|
||||
private mapRow(row: any): Vehicle {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user