Vehicle ETL Process fixed. Admin settings fixed.
This commit is contained in:
@@ -20,6 +20,7 @@ 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';
|
||||
import { PlatformCacheService } from '../../platform/domain/platform-cache.service';
|
||||
import { cacheService } from '../../../core/config/redis';
|
||||
import { pool } from '../../../core/config/database';
|
||||
@@ -35,7 +36,9 @@ export const adminRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
// Initialize catalog dependencies
|
||||
const platformCacheService = new PlatformCacheService(cacheService);
|
||||
const catalogService = new VehicleCatalogService(pool, platformCacheService);
|
||||
const catalogImportService = new CatalogImportService(pool);
|
||||
const catalogController = new CatalogController(catalogService);
|
||||
catalogController.setImportService(catalogImportService);
|
||||
|
||||
// Admin access verification (used by frontend auth checks)
|
||||
fastify.get('/admin/verify', {
|
||||
@@ -205,6 +208,49 @@ export const adminRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
handler: catalogController.getChangeLogs.bind(catalogController)
|
||||
});
|
||||
|
||||
// Search endpoint - full-text search across vehicle_options
|
||||
fastify.get('/admin/catalog/search', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.searchCatalog.bind(catalogController)
|
||||
});
|
||||
|
||||
// Cascade delete endpoints - delete entity and all its children
|
||||
fastify.delete('/admin/catalog/makes/:makeId/cascade', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.deleteMakeCascade.bind(catalogController)
|
||||
});
|
||||
|
||||
fastify.delete('/admin/catalog/models/:modelId/cascade', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.deleteModelCascade.bind(catalogController)
|
||||
});
|
||||
|
||||
fastify.delete('/admin/catalog/years/:yearId/cascade', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.deleteYearCascade.bind(catalogController)
|
||||
});
|
||||
|
||||
fastify.delete('/admin/catalog/trims/:trimId/cascade', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.deleteTrimCascade.bind(catalogController)
|
||||
});
|
||||
|
||||
// Import/Export endpoints
|
||||
fastify.post('/admin/catalog/import/preview', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.importPreview.bind(catalogController)
|
||||
});
|
||||
|
||||
fastify.post('/admin/catalog/import/apply', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.importApply.bind(catalogController)
|
||||
});
|
||||
|
||||
fastify.get('/admin/catalog/export', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
handler: catalogController.exportCatalog.bind(catalogController)
|
||||
});
|
||||
|
||||
// Bulk delete endpoint
|
||||
fastify.delete<{ Params: { entity: CatalogEntity }; Body: BulkDeleteCatalogInput }>('/admin/catalog/:entity/bulk-delete', {
|
||||
preHandler: [fastify.requireAdmin],
|
||||
|
||||
Reference in New Issue
Block a user