Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-vasconcelos committed Feb 10, 2024
1 parent f1af689 commit 0aada3f
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions server/endpoints/network/vehicles.endpoint.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,12 @@
/* * */

const { DateTime } = require('luxon');
const PCGIAPI = require('../../services/PCGIAPI');
const protobuf = require('protobufjs');
const RTEVENTS = require('../../services/RTEVENTS');
const gtfsRealtime = protobuf.loadSync(`${process.env.PWD}/services/gtfs-realtime.proto`);

/* * */

function convertToUTC(localUnixTimestampMili) {
// Create a Date object with the local Unix timestamp and local timezone
return DateTime.fromMillis(localUnixTimestampMili, { zone: 'UTC' }).setZone('Europe/Lisbon', { keepLocalTime: true }).toUTC().toUnixInteger();
}

/* * */

module.exports.json = async (request, reply) => {
// Fetch all vehicles
// const allVehiclesData = await PCGIAPI.request('vehiclelocation/vehiclePosition/mapVehicles');
// Keep only vehicles that match conditions
// const allVehiclesFiltered = allVehiclesData.filter((vehicle) => {
// return true;
// const vehicleIsInTrip = vehicle.Ss === 'STARTED' || vehicle.Ss === 'RUNNING';
// return vehicleIsInTrip;
// });
// Map to API format
// const allVehiclesFormatted = allVehiclesFiltered.map((vehicle) => {
// return {
// id: vehicle.Vid,
// lat: vehicle.Lat,
// lon: vehicle.Lng,
// speed: vehicle.Spd,
// status: vehicle.Ss,
// timestamp: convertToUTC(vehicle.Ts),
// heading: vehicle.Coa,
// trip_id: vehicle.Lna,
// line_id: vehicle.Lna?.substring(0, 4),
// route_id: vehicle.Lna?.substring(0, 6),
// pattern_id: vehicle.Lna?.substring(0, 8),
// };
// });
// Get the saved events from RTEVENTS
const rtFeed = await RTEVENTS.json();
// Return response
Expand Down

0 comments on commit 0aada3f

Please sign in to comment.