refactor: narrow vehicle stat repository contract
This commit is contained in:
@@ -26,8 +26,7 @@ public final class JdbcVehicleStatMetricRepository implements VehicleStatReposit
|
||||
ensureSchema();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDailyStat(VehicleDailyStatResult result) {
|
||||
private void saveDailyMileageMetric(VehicleDailyStatResult result) {
|
||||
if (result == null || result.dailyMileageKm().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +87,7 @@ public final class JdbcVehicleStatMetricRepository implements VehicleStatReposit
|
||||
statDate,
|
||||
OptionalDouble.of(dailyMileageKm),
|
||||
DailyMileageStrategy.JT808_TOTAL_MILEAGE_DIFF);
|
||||
saveDailyStat(result);
|
||||
saveDailyMileageMetric(result);
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ import java.util.Optional;
|
||||
|
||||
public interface VehicleStatRepository {
|
||||
|
||||
void saveDailyStat(VehicleDailyStatResult result);
|
||||
|
||||
Optional<VehicleDailyStatResult> recordDailyMileageSample(String vin, LocalDate statDate, double totalMileageKm);
|
||||
|
||||
Optional<VehicleDailyStatResult> findDailyStat(String vin, LocalDate statDate);
|
||||
|
||||
Reference in New Issue
Block a user