feat: Backup & Restore - Manual backup tested complete.
This commit is contained in:
@@ -24,9 +24,6 @@ import {
|
||||
UpdateProfileInput,
|
||||
PromoteToAdminInput,
|
||||
} from './users.validation';
|
||||
import { AdminRepository } from '../data/admin.repository';
|
||||
import { StationOversightService } from '../domain/station-oversight.service';
|
||||
import { StationsController } from './stations.controller';
|
||||
import { CatalogController } from './catalog.controller';
|
||||
import { VehicleCatalogService } from '../domain/vehicle-catalog.service';
|
||||
import { CatalogImportService } from '../domain/catalog-import.service';
|
||||
@@ -34,16 +31,12 @@ import { PlatformCacheService } from '../../platform/domain/platform-cache.servi
|
||||
import { cacheService } from '../../../core/config/redis';
|
||||
import { pool } from '../../../core/config/database';
|
||||
import { CommunityStationsController } from '../../stations/api/community-stations.controller';
|
||||
import { registerBackupRoutes } from '../../backup/api/backup.routes';
|
||||
|
||||
export const adminRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
const adminController = new AdminController();
|
||||
const usersController = new UsersController();
|
||||
|
||||
// Initialize station oversight dependencies
|
||||
const adminRepository = new AdminRepository(pool);
|
||||
const stationOversightService = new StationOversightService(pool, adminRepository);
|
||||
const stationsController = new StationsController(stationOversightService);
|
||||
|
||||
// Initialize community stations dependencies
|
||||
const communityStationsController = new CommunityStationsController();
|
||||
|
||||
@@ -323,45 +316,7 @@ export const adminRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
handler: catalogController.bulkDeleteCatalogEntity.bind(catalogController)
|
||||
});
|
||||
|
||||
// Phase 4: Station oversight endpoints
|
||||
|
||||
// GET /api/admin/stations - List all stations globally
|
||||
fastify.get('/admin/stations', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: stationsController.listAllStations.bind(stationsController)
|
||||
});
|
||||
|
||||
// POST /api/admin/stations - Create new station
|
||||
fastify.post('/admin/stations', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: stationsController.createStation.bind(stationsController)
|
||||
});
|
||||
|
||||
// PUT /api/admin/stations/:stationId - Update station
|
||||
fastify.put('/admin/stations/:stationId', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: stationsController.updateStation.bind(stationsController)
|
||||
});
|
||||
|
||||
// DELETE /api/admin/stations/:stationId - Delete station (soft delete by default, ?force=true for hard delete)
|
||||
fastify.delete('/admin/stations/:stationId', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: stationsController.deleteStation.bind(stationsController)
|
||||
});
|
||||
|
||||
// GET /api/admin/users/:userId/stations - Get user's saved stations
|
||||
fastify.get('/admin/users/:userId/stations', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: stationsController.getUserSavedStations.bind(stationsController)
|
||||
});
|
||||
|
||||
// DELETE /api/admin/users/:userId/stations/:stationId - Remove user's saved station (soft delete by default, ?force=true for hard delete)
|
||||
fastify.delete('/admin/users/:userId/stations/:stationId', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: stationsController.removeUserSavedStation.bind(stationsController)
|
||||
});
|
||||
|
||||
// Phase 5: Community gas station submission oversight
|
||||
// Community gas station submission oversight
|
||||
|
||||
// GET /api/admin/community-stations - List all submissions with filters
|
||||
fastify.get('/admin/community-stations', {
|
||||
@@ -380,4 +335,9 @@ export const adminRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: communityStationsController.reviewStation.bind(communityStationsController)
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// Backup & Restore endpoints
|
||||
// ============================================
|
||||
await registerBackupRoutes(fastify, { pool });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user