chore: add missing auth utils and public routes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
45
packages/server/src/routes/public.routes.ts
Normal file
45
packages/server/src/routes/public.routes.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user