feat: add SMS diagnostics admin check
This commit is contained in:
@@ -5,6 +5,7 @@ import ExcelJS from 'exceljs';
|
||||
import { ok } from '../http/apiResponse.js';
|
||||
import { ApiError } from '../http/errors.js';
|
||||
import { query } from '../db/pool.js';
|
||||
import { diagnoseSmsConnectivity } from '../services/sms.js';
|
||||
import { parseRole, parseRoles, requireAdmin, requireCurrentUser, type QueryFn, type UserRow } from './security.js';
|
||||
|
||||
type Row = Record<string, unknown>;
|
||||
@@ -469,6 +470,11 @@ export function createAdminRouter(deps: AdminRouterDeps = { query }): Router {
|
||||
ok(res, await watcher1(dbQuery));
|
||||
}));
|
||||
|
||||
router.post('/sms/diagnostics', asyncRoute(async (req, res) => {
|
||||
await requireAdmin(dbQuery, req);
|
||||
ok(res, await diagnoseSmsConnectivity());
|
||||
}));
|
||||
|
||||
router.get('/teams', asyncRoute(async (req, res) => {
|
||||
await requireAdmin(dbQuery, req);
|
||||
ok(res, await listTeams(dbQuery));
|
||||
|
||||
Reference in New Issue
Block a user