Change properties to match GraphQL input and query result

This commit is contained in:
2025-07-19 12:15:41 -04:00
parent 8ee1f1522e
commit 182587596c
4 changed files with 22 additions and 22 deletions

View File

@@ -160,11 +160,11 @@ export class RedisParkingRepository extends BaseRedisRepository implements Parki
options: ParkingStructureCountOptions
): Promise<HistoricalParkingAverageQueryResult[]> => {
const keys = this.createRedisKeys(id);
const { startUnixEpochMs, endUnixEpochMs, intervalMs } = options;
const { from, to, intervalMs } = options;
const results: HistoricalParkingAverageQueryResult[] = [];
let currentIntervalStart = startUnixEpochMs.getTime();
const endTime = endUnixEpochMs.getTime();
let currentIntervalStart = from.getTime();
const endTime = to.getTime();
while (currentIntervalStart < endTime) {
const currentIntervalEnd = Math.min(currentIntervalStart + intervalMs, endTime);
@@ -183,8 +183,8 @@ export class RedisParkingRepository extends BaseRedisRepository implements Parki
if (aggregationResult && aggregationResult.length > 0) {
const [, averageValue] = aggregationResult[0];
results.push({
fromUnixEpochMs: new Date(currentIntervalStart),
toUnixEpochMs: new Date(currentIntervalEnd),
from: new Date(currentIntervalStart),
to: new Date(currentIntervalEnd),
averageSpotsAvailable: parseFloat(averageValue)
});
}