mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
update resolvers to pull eta data from apiBasedRepository
This commit is contained in:
@@ -132,10 +132,10 @@ export const resolvers: Resolvers<ServerContext> = {
|
||||
Shuttle: {
|
||||
eta: async (parent, args, contextValue, info) => {
|
||||
if (!args.forStopId) return null;
|
||||
const etaForStopId = await contextValue.repository.getEtaForShuttleAndStopId(parent.id, args.forStopId);
|
||||
const etaForStopId = await contextValue.apiBasedRepository.getEtaForShuttleAndStopId(parent.id, args.forStopId);
|
||||
if (etaForStopId === null) return null;
|
||||
|
||||
const stop = await contextValue.repository.getStopById(etaForStopId.stopId);
|
||||
const stop = await contextValue.apiBasedRepository.getStopById(etaForStopId.stopId);
|
||||
if (stop === null) return null;
|
||||
|
||||
return {
|
||||
@@ -149,14 +149,14 @@ export const resolvers: Resolvers<ServerContext> = {
|
||||
};
|
||||
},
|
||||
etas: async (parent, args, contextValue, info) => {
|
||||
const etasForShuttle = await contextValue.repository.getEtasForShuttleId(parent.id);
|
||||
const etasForShuttle = await contextValue.apiBasedRepository.getEtasForShuttleId(parent.id);
|
||||
if (!etasForShuttle) return null;
|
||||
|
||||
const computedEtas = await Promise.all(etasForShuttle.map(async ({
|
||||
secondsRemaining,
|
||||
stopId,
|
||||
}): Promise<Eta | null> => {
|
||||
const stop = await contextValue.repository.getStopById(stopId);
|
||||
const stop = await contextValue.apiBasedRepository.getStopById(stopId);
|
||||
if (stop === null) return null;
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user