Skip to content

Commit

Permalink
Add test estimate response for 'no-service' stop ID in PIP connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-vasconcelos committed Feb 13, 2025
1 parent 3cfd741 commit 14f36ac
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions apps/server/src/endpoints/pips/estimates.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,55 @@ FASTIFY.server.post<RequestSchema>('/pips/estimates', async (request, reply) =>
.header('cache-control', 'public, no-cache')
.send(response);
}

//
// Handle the special case for testing PIP connectivity
// If the stop ID is '000000', return a single test estimate

if (stopId === 'no-service') {
const response: PipArrival[] = [
{
estimatedArrivalTime: '23:59:59',
estimatedDepartureTime: '23:59:59',
estimatedTimeString: '-',
estimatedTimeUnixSeconds: 0,
journeyId: '0000_0_0|teste',
lineId: '0000',
observedArrivalTime: null,
observedDepartureTime: null,
observedDriverId: '', // Deprecated
observedVehicleId: '0000',
operatorId: '', // Deprecated
patternId: '0000_0_0',
stopHeadsign: 'Painel inativo, paragem desativada.',
stopId: '', // Deprecated
timetabledArrivalTime: '23:59:59',
timetabledDepartureTime: '23:59:59',
},
{
estimatedArrivalTime: '23:59:59',
estimatedDepartureTime: '23:59:59',
estimatedTimeString: '›››',
estimatedTimeUnixSeconds: 0,
journeyId: '0000_0_0|teste',
lineId: '0000',
observedArrivalTime: null,
observedDepartureTime: null,
observedDriverId: '', // Deprecated
observedVehicleId: '0000',
operatorId: '', // Deprecated
patternId: '0000_0_0',
stopHeadsign: 'Olá :)',
stopId: '', // Deprecated
timetabledArrivalTime: '23:59:59',
timetabledDepartureTime: '23:59:59',
},
];
return reply
.code(200)
.header('cache-control', 'public, no-cache')
.send(response);
}
}

//
Expand Down

0 comments on commit 14f36ac

Please sign in to comment.