mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
HealthLog — personal health-tracking PWA with weight, blood pressure, pulse, mood tracking, medication compliance, Withings integration, doctor report PDF export, and Dracula-themed UI.
30 lines
728 B
TypeScript
30 lines
728 B
TypeScript
import { prisma } from "@/lib/db";
|
|
import { apiHandler, requireAdmin } from "@/lib/api-handler";
|
|
import { apiSuccess } from "@/lib/api-response";
|
|
import { annotate } from "@/lib/logging/context";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export const GET = apiHandler(async () => {
|
|
await requireAdmin();
|
|
annotate({ action: { name: "admin.tokens.list" } });
|
|
|
|
const tokens = await prisma.apiToken.findMany({
|
|
select: {
|
|
id: true,
|
|
name: true,
|
|
permissions: true,
|
|
lastUsedAt: true,
|
|
expiresAt: true,
|
|
createdAt: true,
|
|
revoked: true,
|
|
user: {
|
|
select: { id: true, username: true },
|
|
},
|
|
},
|
|
orderBy: { createdAt: "desc" },
|
|
});
|
|
|
|
return apiSuccess(tokens);
|
|
});
|