diff --git a/src/scripts/databaseRepositories/refuelRepository.ts b/src/scripts/databaseRepositories/refuelRepository.ts index 8b860c3c..52b3e7ef 100644 --- a/src/scripts/databaseRepositories/refuelRepository.ts +++ b/src/scripts/databaseRepositories/refuelRepository.ts @@ -25,7 +25,13 @@ async function getFilteredRefuels( } async function addRefuel(refuel: Refuel): Promise { - return (await db.refuels.add(refuel)) as number + return (await db.refuels.add({ + date: refuel.date, + refueledAmount: refuel.refueledAmount, + payedAmount: refuel.payedAmount, + distanceDriven: refuel.distanceDriven, + vehicleId: refuel.distanceDriven + } as Refuel)) as number } async function updateRefuel(refuel: Refuel) { diff --git a/src/scripts/databaseRepositories/vehicleRepository.ts b/src/scripts/databaseRepositories/vehicleRepository.ts index 6114600f..28cc80d2 100644 --- a/src/scripts/databaseRepositories/vehicleRepository.ts +++ b/src/scripts/databaseRepositories/vehicleRepository.ts @@ -20,7 +20,12 @@ async function getVehicles(): Promise { } async function addVehicle(vehicle: Vehicle): Promise { - return (await db.vehicles.add(vehicle)) as number + return (await db.vehicles.add({ + name: vehicle.name, + plateNumber: vehicle.plateNumber, + currencyUnit: vehicle.currencyUnit, + fuelUnitId: vehicle.fuelUnitId + } as Vehicle)) as number } async function updateVehicle(vehicle: Vehicle) {