Skip to content

Commit

Permalink
fix(server/vehicle): clear properties from metadata after db insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Nov 27, 2024
1 parent 87714bf commit 251cbd3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/vehicle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ export async function CreateVehicle(
: await OxVehicle.generatePlate();

const metadata = data.data || ({} as { properties?: VehicleProperties; [key: string]: any });
const properties = data.properties || metadata.properties || ({} as VehicleProperties);
delete metadata.properties;

if (!data.id && data.vin) {
data.id = await CreateNewVehicle(
Expand All @@ -78,7 +76,10 @@ export async function CreateVehicle(
);
}

if (!entity) return;
if (!entity || !DoesEntityExist(entity)) return;

const properties = data.properties || metadata.properties || ({} as VehicleProperties);
delete metadata.properties;

return new OxVehicle(
entity,
Expand Down

0 comments on commit 251cbd3

Please sign in to comment.