fix(admin): Support entry in sidebar + awaiting-admin badge
All checks were successful
Deploy to Production / deploy (push) Successful in 52s
All checks were successful
Deploy to Production / deploy (push) Successful in 52s
The /admin/support page existed but was invisible from the panel — sidebar NAV array didn't list it. Adds Support as the 2nd nav item (right after Overview, since unanswered tickets are the most-time-sensitive thing an admin checks). Sidebar polls /v1/admin/support/counts every 30s and renders an amber count badge next to the entry when tickets are awaiting_admin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
createDb,
|
||||
desc,
|
||||
eq,
|
||||
sql,
|
||||
supportMessages,
|
||||
supportTickets,
|
||||
users,
|
||||
@@ -182,6 +183,18 @@ export async function supportRoutes(app: FastifyInstance): Promise<void> {
|
||||
});
|
||||
|
||||
// ─── Admin-side ────────────────────────────────────────────────────────
|
||||
app.get(
|
||||
'/v1/admin/support/counts',
|
||||
{ preHandler: requireAdmin },
|
||||
async (_req, reply) => {
|
||||
const [row] = await db
|
||||
.select({ count: sql<number>`count(*)::int` })
|
||||
.from(supportTickets)
|
||||
.where(eq(supportTickets.status, 'awaiting_admin'));
|
||||
return reply.send({ awaitingAdmin: row?.count ?? 0 });
|
||||
},
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/v1/admin/support/tickets',
|
||||
{ preHandler: requireAdmin },
|
||||
|
||||
Reference in New Issue
Block a user