mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
change all millisecond references into Dates
This commit is contained in:
@@ -59,7 +59,7 @@ export class ChapmanApiBasedParkingRepositoryLoader implements ParkingRepository
|
||||
name: jsonStructure.Name,
|
||||
spotsAvailable: jsonStructure.CurrentCount > jsonStructure.Capacity ? jsonStructure.Capacity : jsonStructure.CurrentCount,
|
||||
address: jsonStructure.Address,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
|
||||
return structureToReturn;
|
||||
|
||||
@@ -12,7 +12,7 @@ const parkingStructures: IParkingStructure[] = [
|
||||
},
|
||||
name: "Anderson Structure",
|
||||
id: "1",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
address: "200 W Sycamore Ave, Orange, CA 92866-1053",
|
||||
@@ -24,7 +24,7 @@ const parkingStructures: IParkingStructure[] = [
|
||||
},
|
||||
name: "Barrera",
|
||||
id: "2",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
id: jsonRoute.myid,
|
||||
polylineCoordinates: [],
|
||||
systemId: this.systemIdForConstructedData,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
|
||||
await this.repository.addOrUpdateRoute(constructedRoute);
|
||||
@@ -174,7 +174,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
systemId: this.systemIdForConstructedData,
|
||||
id: `${jsonBus.busId}`,
|
||||
orientationInDegrees: parseFloat(jsonBus.calculatedCourse),
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
|
||||
await this.repository.addOrUpdateShuttle(constructedShuttle);
|
||||
@@ -223,7 +223,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
secondsRemaining: jsonEta.secondsSpent,
|
||||
shuttleId: `${shuttleId}`,
|
||||
stopId: stopId,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
systemId: this.systemIdForConstructedData,
|
||||
};
|
||||
|
||||
@@ -251,7 +251,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
latitude: parseFloat(stop.latitude),
|
||||
longitude: parseFloat(stop.longitude),
|
||||
},
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
|
||||
await this.repository.addOrUpdateStop(constructedStop);
|
||||
@@ -283,7 +283,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
stopId,
|
||||
position: index + 1,
|
||||
systemId: this.systemIdForConstructedData,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
stopId: jsonOrderedStopData[index - 1][1],
|
||||
position: index,
|
||||
systemId: this.systemIdForConstructedData,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
}
|
||||
if (index < jsonOrderedStopData.length - 1) {
|
||||
@@ -302,7 +302,7 @@ export class ApiBasedShuttleRepositoryLoader implements ShuttleRepositoryLoader
|
||||
stopId: jsonOrderedStopData[index + 1][1],
|
||||
position: index + 2,
|
||||
systemId: this.systemIdForConstructedData,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4324,7 +4324,7 @@ const routes: IRoute[] = [
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
polylineCoordinates: redRoutePolylineCoordinates,
|
||||
color: "#db2316",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
name: "Teal Route",
|
||||
@@ -4332,7 +4332,7 @@ const routes: IRoute[] = [
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
polylineCoordinates: tealRoutePolylineCoordinates,
|
||||
color: "#21bdd1",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -4345,7 +4345,7 @@ const stops: IStop[] = [
|
||||
longitude: -117.8892805,
|
||||
},
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
@@ -4355,7 +4355,7 @@ const stops: IStop[] = [
|
||||
longitude: -117.895966,
|
||||
},
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
@@ -4365,7 +4365,7 @@ const stops: IStop[] = [
|
||||
"longitude": -117.85281
|
||||
},
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
];
|
||||
|
||||
@@ -4375,14 +4375,14 @@ const orderedStopsForRedRoute: IOrderedStop[] = [
|
||||
stopId: stops[0].id,
|
||||
position: 1,
|
||||
systemId: "1",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
routeId: routes[0].id,
|
||||
stopId: stops[2].id,
|
||||
position: 2,
|
||||
systemId: "1",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -4392,21 +4392,21 @@ const orderedStopsForTealRoute: IOrderedStop[] = [
|
||||
stopId: stops[0].id,
|
||||
position: 1,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
routeId: routes[1].id,
|
||||
stopId: stops[1].id,
|
||||
position: 2,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
routeId: routes[1].id,
|
||||
stopId: stops[2].id,
|
||||
position: 2,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -4426,7 +4426,7 @@ const shuttles: IShuttle[] = [
|
||||
routeId: routes[0].id,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
orientationInDegrees: 45.91,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
name: "24",
|
||||
@@ -4438,7 +4438,7 @@ const shuttles: IShuttle[] = [
|
||||
routeId: routes[0].id,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
orientationInDegrees: 90.24,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
];
|
||||
|
||||
@@ -4448,28 +4448,28 @@ const etas: IEta[] = [
|
||||
shuttleId: shuttles[0].id,
|
||||
secondsRemaining: 12.023,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
stopId: stops[2].id,
|
||||
shuttleId: shuttles[0].id,
|
||||
secondsRemaining: 600.123,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
stopId: stops[2].id,
|
||||
shuttleId: shuttles[1].id,
|
||||
secondsRemaining: 172.015,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
stopId: stops[0].id,
|
||||
shuttleId: shuttles[1].id,
|
||||
secondsRemaining: 710.152,
|
||||
systemId: supportedIntegrationTestSystems[0].id,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServerContext } from "../ServerContext";
|
||||
|
||||
export const RouteResolvers: Resolvers<ServerContext> = {
|
||||
Route: {
|
||||
shuttles: async (parent, args, contextValue, info) => {
|
||||
shuttles: async (parent, args, contextValue, _info) => {
|
||||
const system = contextValue.findSystemById(parent.systemId);
|
||||
if (!system) return null;
|
||||
|
||||
@@ -23,10 +23,10 @@ export const RouteResolvers: Resolvers<ServerContext> = {
|
||||
id,
|
||||
orientationInDegrees,
|
||||
systemId: parent.systemId,
|
||||
updatedTime: updatedTimeMs,
|
||||
updatedTime,
|
||||
}));
|
||||
},
|
||||
orderedStop: async (parent, args, contextValue, info) => {
|
||||
orderedStop: async (parent, args, contextValue, _info) => {
|
||||
if (!args.forStopId) return null;
|
||||
|
||||
const system = contextValue.findSystemById(parent.systemId);
|
||||
|
||||
@@ -59,7 +59,7 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
|
||||
},
|
||||
name: "Anderson Structure",
|
||||
id: "",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
address: "200 W Sycamore Ave, Orange, CA 92866-1053",
|
||||
@@ -71,7 +71,7 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
|
||||
},
|
||||
name: "Barrera",
|
||||
id: "",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
];
|
||||
expectedStructures[0].id = ChapmanApiBasedParkingRepositoryLoader.generateId(expectedStructures[0].address);
|
||||
|
||||
@@ -52,7 +52,7 @@ describe("ETANotificationScheduler", () => {
|
||||
stopId: stop.id,
|
||||
secondsRemaining: 120,
|
||||
systemId: "1",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
|
||||
const notificationData1 = {
|
||||
|
||||
@@ -14,7 +14,7 @@ describe("InMemoryParkingRepository", () => {
|
||||
name: "Anderson Parking Structure",
|
||||
capacity: 100,
|
||||
address: "300 E Walnut Ave, Orange, CA 92867",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,7 @@ export function generateParkingStructures(): IParkingStructure[] {
|
||||
"name": "Anderson Structure",
|
||||
"spotsAvailable": 163,
|
||||
"address": "300 E Walnut, Orange, CA 92867",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
"capacity": 692,
|
||||
@@ -29,7 +29,7 @@ export function generateParkingStructures(): IParkingStructure[] {
|
||||
"name": "Barrera",
|
||||
"spotsAvailable": 179,
|
||||
"address": "200 W Sycamore Ave, Orange, CA 92866-1053",
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -46,7 +46,7 @@ export function generateMockShuttles(): IShuttle[] {
|
||||
longitude: 20
|
||||
},
|
||||
orientationInDegrees: 25.163,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
id: "sh2",
|
||||
@@ -58,7 +58,7 @@ export function generateMockShuttles(): IShuttle[] {
|
||||
longitude: 25
|
||||
},
|
||||
orientationInDegrees: 50.912,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
{
|
||||
id: "sh3",
|
||||
@@ -70,40 +70,40 @@ export function generateMockShuttles(): IShuttle[] {
|
||||
longitude: 40
|
||||
},
|
||||
orientationInDegrees: 321.019,
|
||||
updatedTime: Date.now(),
|
||||
updatedTime: new Date(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function generateMockRoutes(): IRoute[] {
|
||||
return [
|
||||
{ id: "r1", name: "Route 1", color: "red", systemId: "sys1", polylineCoordinates: [], updatedTime: Date.now() },
|
||||
{ id: "r2", name: "Route 2", color: "blue", systemId: "sys2", polylineCoordinates: [], updatedTime: Date.now() },
|
||||
{ id: "r3", name: "Route 3", color: "green", systemId: "sys3", polylineCoordinates: [], updatedTime: Date.now() },
|
||||
{ id: "r1", name: "Route 1", color: "red", systemId: "sys1", polylineCoordinates: [], updatedTime: new Date() },
|
||||
{ id: "r2", name: "Route 2", color: "blue", systemId: "sys2", polylineCoordinates: [], updatedTime: new Date() },
|
||||
{ id: "r3", name: "Route 3", color: "green", systemId: "sys3", polylineCoordinates: [], updatedTime: new Date() },
|
||||
];
|
||||
}
|
||||
|
||||
export function generateMockStops(): IStop[] {
|
||||
return [
|
||||
{ id: "st1", name: "Stop A", systemId: "sys1", coordinates: { latitude: 10, longitude: 20 }, updatedTime: Date.now() },
|
||||
{ id: "st2", name: "Stop B", systemId: "sys2", coordinates: { latitude: 15, longitude: 25 }, updatedTime: Date.now() },
|
||||
{ id: "st3", name: "Stop C", systemId: "sys3", coordinates: { latitude: 30, longitude: 40 }, updatedTime: Date.now() },
|
||||
{ id: "st1", name: "Stop A", systemId: "sys1", coordinates: { latitude: 10, longitude: 20 }, updatedTime: new Date() },
|
||||
{ id: "st2", name: "Stop B", systemId: "sys2", coordinates: { latitude: 15, longitude: 25 }, updatedTime: new Date() },
|
||||
{ id: "st3", name: "Stop C", systemId: "sys3", coordinates: { latitude: 30, longitude: 40 }, updatedTime: new Date() },
|
||||
];
|
||||
}
|
||||
|
||||
export function generateMockOrderedStops(): IOrderedStop[] {
|
||||
return [
|
||||
{ stopId: "st1", routeId: "r1", position: 1, systemId: "sys1", updatedTime: Date.now(), },
|
||||
{ stopId: "st1", routeId: "r2", position: 2, systemId: "sys1", updatedTime: Date.now(), },
|
||||
{ stopId: "st2", routeId: "r1", position: 3, systemId: "sys1", updatedTime: Date.now(), },
|
||||
{ stopId: "st2", routeId: "r2", position: 4, systemId: "sys1", updatedTime: Date.now(), },
|
||||
{ stopId: "st1", routeId: "r1", position: 1, systemId: "sys1", updatedTime: new Date(), },
|
||||
{ stopId: "st1", routeId: "r2", position: 2, systemId: "sys1", updatedTime: new Date(), },
|
||||
{ stopId: "st2", routeId: "r1", position: 3, systemId: "sys1", updatedTime: new Date(), },
|
||||
{ stopId: "st2", routeId: "r2", position: 4, systemId: "sys1", updatedTime: new Date(), },
|
||||
];
|
||||
}
|
||||
|
||||
export function generateMockEtas(): IEta[] {
|
||||
return [
|
||||
{ shuttleId: "sh1", stopId: "st1", secondsRemaining: 120, systemId: "sys1", updatedTime: Date.now() },
|
||||
{ shuttleId: "sh1", stopId: "st2", secondsRemaining: 180, systemId: "sys1", updatedTime: Date.now() },
|
||||
{ shuttleId: "sh2", stopId: "st3", secondsRemaining: 240, systemId: "sys1", updatedTime: Date.now() },
|
||||
{ shuttleId: "sh1", stopId: "st1", secondsRemaining: 120, systemId: "sys1", updatedTime: new Date() },
|
||||
{ shuttleId: "sh1", stopId: "st2", secondsRemaining: 180, systemId: "sys1", updatedTime: new Date() },
|
||||
{ shuttleId: "sh2", stopId: "st3", secondsRemaining: 240, systemId: "sys1", updatedTime: new Date() },
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user