mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
Change properties to match GraphQL input and query result
This commit is contained in:
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user