import type { Metadata } from "next";
import { requireAdmin } from "@/lib/auth";
import { getSettings } from "@/lib/settings";
import { prisma } from "@/lib/db";
import { env } from "@/lib/env";
import { AppShell } from "@/components/AppShell";
import { AdminSettings, UserRow } from "@/components/settings/Forms";
import { formatRelative } from "@/lib/labels";
export const metadata: Metadata = { title: "Verwaltung" };
export default async function AdminPage() {
const admin = await requireAdmin();
const settings = await getSettings();
const [users, lastRun, catalog] = await Promise.all([
prisma.user.findMany({
orderBy: { createdAt: "asc" },
select: {
id: true,
name: true,
email: true,
role: true,
isActive: true,
_count: { select: { entries: true } },
},
}),
prisma.syncRun.findFirst({ orderBy: { startedAt: "desc" } }),
Promise.all([
prisma.title.count(),
prisma.episode.count(),
prisma.watch.count(),
]),
]);
const [titleCount, episodeCount, watchCount] = catalog;
return (
Einstellungen der Instanz, Konten und Hintergrundlauf.
{formatRelative(lastRun.startedAt)} ·{" "}
{lastRun.ok ? "erfolgreich" : "mit Fehlern"}
{lastRun.message ? ` · ${lastRun.message}` : ""}
Noch kein Abgleich gelaufen.Verwaltung
Instanz
Zustand
Letzter Abgleich
{lastRun ? (
Konten
{users.map((user) => (