Files
ridebus-admin/backend/src/controllers/qualityController.js
Zakhar Timoshenko d13cc92d82 feat: implement multi-city support with city management features
- Added a new cities table to the database to manage multiple cities independently.
- Created a middleware to resolve city context based on X-City-Id header.
- Updated routes and services to handle city-specific data for routes, stops, and alerts.
- Implemented a CityContext in the frontend to manage active city state and provide city data across the application.
- Added a CitySelector component for users to switch between cities.
- Created a CitiesPage for admins to manage cities, including adding new cities with validation.
- Updated various components and pages to reflect the active city context, ensuring data is displayed correctly based on the selected city.
- Enhanced the schedule import functionality to restrict imports based on the active city.
2026-09-17 19:41:17 +03:00

22 lines
740 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const logger = require('../config/logger');
const { runQualityChecks } = require('../services/qualityReport');
class QualityController {
constructor({ pool, report = runQualityChecks } = {}) {
this.pool = pool || require('../config/database');
this.report = report;
}
async getReport(req, res) {
try {
res.json(await this.report(this.pool, req.city.id));
} catch (error) {
logger.error('Error building quality report', { message: error.message });
res.status(500).json({ error: 'Не удалось проверить качество данных. Повторите попытку.' });
}
}
}
module.exports = new QualityController();
module.exports.QualityController = QualityController;