refactor(backend): add status constants and update code to use them
- Create constants/statuses.js with MATCH_STATUS, SUGGESTION_STATUS - Update routes/dashboard.js to use MATCH_STATUS - Update routes/matches.js to use MATCH_STATUS - Update routes/events.js to use SUGGESTION_STATUS - Update services/matching.js to use SUGGESTION_STATUS - Update tests to use constants
This commit is contained in:
@@ -3,6 +3,7 @@ const { prisma } = require('../utils/db');
|
||||
const { authenticate } = require('../middleware/auth');
|
||||
const { getIO } = require('../socket');
|
||||
const matchingService = require('../services/matching');
|
||||
const { SUGGESTION_STATUS } = require('../constants');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
@@ -1122,8 +1123,8 @@ router.post('/:slug/run-matching', authenticate, async (req, res, next) => {
|
||||
const count = await matchingService.saveMatchingResults(event.id, suggestions);
|
||||
|
||||
// Get statistics
|
||||
const notFoundCount = suggestions.filter(s => s.status === 'not_found').length;
|
||||
const matchedCount = suggestions.filter(s => s.status === 'pending').length;
|
||||
const notFoundCount = suggestions.filter(s => s.status === SUGGESTION_STATUS.NOT_FOUND).length;
|
||||
const matchedCount = suggestions.filter(s => s.status === SUGGESTION_STATUS.PENDING).length;
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user