@@ -95,15 +95,10 @@ export async function registerRoutes(app: Express): Promise<Server> {
9595 return ;
9696 }
9797
98- const userToken = authHeader . substring ( 7 ) ;
99-
10098 console . log ( "Fetching real-time location for vehicle:" , vehicleId ) ;
10199
102100 // Use the real DIMO service to get vehicle location
103- const locationData = await dimoService . getVehicleLocation (
104- vehicleId ,
105- userToken ,
106- ) ;
101+ const locationData = await dimoService . getVehicleLocation ( vehicleId ) ;
107102
108103 // Automatically save to GPS storage for visualization
109104 const savedData = await storage . saveGpsData ( locationData ) ;
@@ -133,15 +128,10 @@ export async function registerRoutes(app: Express): Promise<Server> {
133128 return ;
134129 }
135130
136- const userToken = authHeader . substring ( 7 ) ;
137-
138131 console . log ( "Fetching weekly location for vehicle:" , vehicleId ) ;
139132
140133 // Use the real DIMO service to get vehicle location
141- const locationData = await dimoService . getVehicleWeeklyHistory (
142- vehicleId ,
143- userToken ,
144- ) ;
134+ const locationData = await dimoService . getVehicleWeeklyHistory ( vehicleId ) ;
145135 console . log ( "Weekly location data:" , locationData ) ;
146136 // Automatically save to GPS storage for visualization
147137 const savedData = await storage . saveGpsData ( locationData ) ;
@@ -158,67 +148,6 @@ export async function registerRoutes(app: Express): Promise<Server> {
158148 }
159149 } ) ;
160150
161- app . get ( "/api/dimo/vehicles/:vehicleId/data" , async ( req , res ) => {
162- try {
163- const { vehicleId } = req . params ;
164- const authHeader = req . headers . authorization ;
165-
166- if ( ! authHeader || ! authHeader . startsWith ( "Bearer " ) ) {
167- res
168- . status ( 401 )
169- . json ( { message : "Missing or invalid authorization token" } ) ;
170- return ;
171- }
172-
173- const userToken = authHeader . substring ( 7 ) ;
174- const vehicleData = await dimoService . getVehicleData (
175- vehicleId ,
176- userToken ,
177- ) ;
178- res . json ( vehicleData ) ;
179- } catch ( error ) {
180- console . error ( "Error fetching DIMO vehicle data:" , error ) ;
181- res
182- . status ( 500 )
183- . json ( { message : "Failed to fetch vehicle data from DIMO" } ) ;
184- }
185- } ) ;
186-
187- app . get ( "/api/dimo/vehicles/:vehicleId/telemetry" , async ( req , res ) => {
188- try {
189- const { vehicleId } = req . params ;
190- const { signals } = req . query ;
191- const authHeader = req . headers . authorization ;
192-
193- if ( ! authHeader || ! authHeader . startsWith ( "Bearer " ) ) {
194- res
195- . status ( 401 )
196- . json ( { message : "Missing or invalid authorization token" } ) ;
197- return ;
198- }
199-
200- const requestedSignals = signals ? ( signals as string ) . split ( "," ) : [ ] ;
201- const telemetryData = await dimoService . getVehicleTelemetry (
202- vehicleId ,
203- requestedSignals ,
204- ) ;
205- res . json ( telemetryData ) ;
206- } catch ( error ) {
207- console . error ( "Error fetching DIMO vehicle telemetry:" , error ) ;
208- res
209- . status ( 500 )
210- . json ( { message : "Failed to fetch vehicle telemetry from DIMO" } ) ;
211- }
212- } ) ;
213-
214- // Legacy route - redirects to new endpoint
215- app . get ( "/api/dimo/shared-vehicles" , async ( req , res ) => {
216- res . status ( 410 ) . json ( {
217- message :
218- "This endpoint has been deprecated. Please use /api/dimo/vehicles with proper authentication." ,
219- } ) ;
220- } ) ;
221-
222151 const httpServer = createServer ( app ) ;
223152 return httpServer ;
224153}
0 commit comments