Initial Commit
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
StationParams
|
||||
} from '../domain/stations.types';
|
||||
import { StationsController } from './stations.controller';
|
||||
import { tenantMiddleware } from '../../../core/middleware/tenant';
|
||||
|
||||
export const stationsRoutes: FastifyPluginAsync = async (
|
||||
fastify: FastifyInstance,
|
||||
@@ -20,25 +21,25 @@ export const stationsRoutes: FastifyPluginAsync = async (
|
||||
|
||||
// POST /api/stations/search - Search nearby stations
|
||||
fastify.post<{ Body: StationSearchBody }>('/stations/search', {
|
||||
preHandler: fastify.authenticate,
|
||||
preHandler: [fastify.authenticate, tenantMiddleware],
|
||||
handler: stationsController.searchStations.bind(stationsController)
|
||||
});
|
||||
|
||||
// POST /api/stations/save - Save a station to user's favorites
|
||||
fastify.post<{ Body: SaveStationBody }>('/stations/save', {
|
||||
preHandler: fastify.authenticate,
|
||||
preHandler: [fastify.authenticate, tenantMiddleware],
|
||||
handler: stationsController.saveStation.bind(stationsController)
|
||||
});
|
||||
|
||||
// GET /api/stations/saved - Get user's saved stations
|
||||
fastify.get('/stations/saved', {
|
||||
preHandler: fastify.authenticate,
|
||||
preHandler: [fastify.authenticate, tenantMiddleware],
|
||||
handler: stationsController.getSavedStations.bind(stationsController)
|
||||
});
|
||||
|
||||
// DELETE /api/stations/saved/:placeId - Remove saved station
|
||||
fastify.delete<{ Params: StationParams }>('/stations/saved/:placeId', {
|
||||
preHandler: fastify.authenticate,
|
||||
preHandler: [fastify.authenticate, tenantMiddleware],
|
||||
handler: stationsController.removeSavedStation.bind(stationsController)
|
||||
});
|
||||
};
|
||||
@@ -46,4 +47,4 @@ export const stationsRoutes: FastifyPluginAsync = async (
|
||||
// For backward compatibility during migration
|
||||
export function registerStationsRoutes() {
|
||||
throw new Error('registerStationsRoutes is deprecated - use stationsRoutes Fastify plugin instead');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user