fix: edit vehicle null fix
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m32s
Deploy to Staging / Deploy to Staging (push) Successful in 27s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2025-12-31 15:33:27 -06:00
parent d9cc604137
commit 52f9414fd4
5 changed files with 53 additions and 34 deletions

View File

@@ -29,11 +29,14 @@ export class VehiclesService {
}
async createVehicle(data: CreateVehicleRequest, userId: string): Promise<VehicleResponse> {
logger.info('Creating vehicle', { userId, vin: data.vin, licensePlate: (data as any).licensePlate });
logger.info('Creating vehicle', { userId, vin: data.vin, licensePlate: data.licensePlate });
// Pre-1981 vehicles have no VIN format requirement
const isPreModern = data.year && data.year < 1981;
if (data.vin) {
// Validate VIN if provided
if (!isValidVIN(data.vin)) {
// Validate VIN format only for modern vehicles (1981+)
if (!isPreModern && !isValidVIN(data.vin)) {
throw new Error('Invalid VIN format');
}
// Duplicate check only when VIN is present