mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Merge pull request #30 from brendan-ch/feat/orientation-data
feat/orientation-data
This commit is contained in:
@@ -57,6 +57,7 @@ type Shuttle {
|
|||||||
routeId: ID!
|
routeId: ID!
|
||||||
etas: [ETA!]
|
etas: [ETA!]
|
||||||
eta(forStopId: ID): ETA
|
eta(forStopId: ID): ETA
|
||||||
|
orientationInDegrees: Float!
|
||||||
}
|
}
|
||||||
|
|
||||||
# Queries
|
# Queries
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export interface IShuttle extends IEntityWithId, IEntityWithOptionalTimestamp {
|
|||||||
name: string;
|
name: string;
|
||||||
routeId: string;
|
routeId: string;
|
||||||
systemId: string;
|
systemId: string;
|
||||||
|
orientationInDegrees: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEta extends IEntityWithOptionalTimestamp {
|
export interface IEta extends IEntityWithOptionalTimestamp {
|
||||||
|
|||||||
@@ -225,7 +225,8 @@ export class ApiBasedRepositoryLoader implements RepositoryLoader {
|
|||||||
},
|
},
|
||||||
routeId: jsonBus.routeId,
|
routeId: jsonBus.routeId,
|
||||||
systemId: systemId,
|
systemId: systemId,
|
||||||
id: `${jsonBus.busId}`
|
id: `${jsonBus.busId}`,
|
||||||
|
orientationInDegrees: parseFloat(jsonBus.calculatedCourse)
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.repository.addOrUpdateShuttle(constructedShuttle);
|
await this.repository.addOrUpdateShuttle(constructedShuttle);
|
||||||
|
|||||||
@@ -4416,6 +4416,7 @@ const shuttles: IShuttle[] = [
|
|||||||
},
|
},
|
||||||
routeId: routes[0].id,
|
routeId: routes[0].id,
|
||||||
systemId: systems[0].id,
|
systemId: systems[0].id,
|
||||||
|
orientationInDegrees: 45.91,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "24",
|
name: "24",
|
||||||
@@ -4426,6 +4427,7 @@ const shuttles: IShuttle[] = [
|
|||||||
},
|
},
|
||||||
routeId: routes[0].id,
|
routeId: routes[0].id,
|
||||||
systemId: systems[0].id,
|
systemId: systems[0].id,
|
||||||
|
orientationInDegrees: 90.24,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ export const RouteResolvers: Resolvers<ServerContext> = {
|
|||||||
coordinates,
|
coordinates,
|
||||||
name,
|
name,
|
||||||
id,
|
id,
|
||||||
|
orientationInDegrees
|
||||||
}) => ({
|
}) => ({
|
||||||
coordinates: coordinates as Coordinates,
|
coordinates: coordinates as Coordinates,
|
||||||
name,
|
name,
|
||||||
route: parent,
|
route: parent,
|
||||||
routeId: parent.id,
|
routeId: parent.id,
|
||||||
id,
|
id,
|
||||||
|
orientationInDegrees
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
orderedStop: async (parent, args, contextValue, info) => {
|
orderedStop: async (parent, args, contextValue, info) => {
|
||||||
|
|||||||
@@ -13,9 +13,39 @@ export function generateMockSystems(): ISystem[] {
|
|||||||
|
|
||||||
export function generateMockShuttles(): IShuttle[] {
|
export function generateMockShuttles(): IShuttle[] {
|
||||||
return [
|
return [
|
||||||
{ id: "sh1", name: "Shuttle A", routeId: "r1", systemId: "sys1", coordinates: { latitude: 10, longitude: 20 } },
|
{
|
||||||
{ id: "sh2", name: "Shuttle B", routeId: "r2", systemId: "sys2", coordinates: { latitude: 15, longitude: 25 } },
|
id: "sh1",
|
||||||
{ id: "sh3", name: "Shuttle C", routeId: "r3", systemId: "sys3", coordinates: { latitude: 30, longitude: 40 } },
|
name: "Shuttle A",
|
||||||
|
routeId: "r1",
|
||||||
|
systemId: "sys1",
|
||||||
|
coordinates: {
|
||||||
|
latitude: 10,
|
||||||
|
longitude: 20
|
||||||
|
},
|
||||||
|
orientationInDegrees: 25.163
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "sh2",
|
||||||
|
name: "Shuttle B",
|
||||||
|
routeId: "r2",
|
||||||
|
systemId: "sys2",
|
||||||
|
coordinates: {
|
||||||
|
latitude: 15,
|
||||||
|
longitude: 25
|
||||||
|
},
|
||||||
|
orientationInDegrees: 50.912
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "sh3",
|
||||||
|
name: "Shuttle C",
|
||||||
|
routeId: "r3",
|
||||||
|
systemId: "sys3",
|
||||||
|
coordinates: {
|
||||||
|
latitude: 30,
|
||||||
|
longitude: 40
|
||||||
|
},
|
||||||
|
orientationInDegrees: 321.019
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user