3c892d02ed
Jenkins Production Deployment
Reviewed-on: #13 Co-authored-by: Patrick Müller <mail@pmueller.me> Co-committed-by: Patrick Müller <mail@pmueller.me>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import express, {Request, Response} from 'express';
|
|
import {requireAdminAuth} from '../tickets.auth.js';
|
|
import {vouchersAdminRouter} from './vouchers.admin.router.js';
|
|
import {redemptionsAdminRouter, voucherHistoryRouter} from './redemptions.admin.router.js';
|
|
import {eventsAdminRouter} from './events.admin.router.js';
|
|
|
|
export const adminRouter = express.Router();
|
|
|
|
// Applied once at the top of the admin router tree - every route below
|
|
// requires a valid admin session (mirrors Feedback's admin.router.ts).
|
|
adminRouter.use(requireAdminAuth);
|
|
|
|
/**
|
|
* @swagger
|
|
* /tickets/admin/me:
|
|
* get:
|
|
* summary: Validate the current admin session
|
|
* tags: [tickets-admin]
|
|
* security:
|
|
* - AdminSessionCookie: []
|
|
* responses:
|
|
* 200:
|
|
* description: Success
|
|
* 401:
|
|
* description: Unauthorized
|
|
* 403:
|
|
* description: Signed in without the permission for this app, or account disabled
|
|
*/
|
|
adminRouter.get('/me', (req: Request, res: Response) => {
|
|
res.status(200).send({email: res.locals.admin.email, fullName: res.locals.admin.displayName});
|
|
});
|
|
|
|
adminRouter.use('/vouchers', vouchersAdminRouter);
|
|
adminRouter.use('/vouchers', voucherHistoryRouter);
|
|
adminRouter.use('/redemptions', redemptionsAdminRouter);
|
|
adminRouter.use('/events', eventsAdminRouter);
|