46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { Router, IRouter } from 'express';
|
|
import { prizeConfigService } from '../services/prize-config.service';
|
|
import { participantService } from '../services/participant.service';
|
|
|
|
const router: IRouter = Router();
|
|
|
|
/**
|
|
* GET /api/public/prizes
|
|
* Public read-only prize configuration (for screen display)
|
|
*/
|
|
router.get('/prizes', (_req, res, next) => {
|
|
try {
|
|
const config = prizeConfigService.getFullConfig();
|
|
return res.json({
|
|
success: true,
|
|
data: config,
|
|
});
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
});
|
|
|
|
/**
|
|
* GET /api/public/participants
|
|
* Public read-only participant list (for screen display)
|
|
*/
|
|
router.get('/participants', (_req, res, next) => {
|
|
try {
|
|
const participants = participantService.getAll();
|
|
const stats = participantService.getStats();
|
|
return res.json({
|
|
success: true,
|
|
data: {
|
|
count: participants.length,
|
|
tagDistribution: stats.tagDistribution,
|
|
participants,
|
|
},
|
|
});
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
});
|
|
|
|
export default router;
|
|
|