import Link from "next/link"; import { redirect } from "next/navigation"; import { RoleCode } from "@prisma/client"; import { ShellPage } from "@/components/page-templates"; import { Button, SectionCard } from "@/components/ui"; import { getSession } from "@/lib/auth"; import { updateTeamUser } from "@/lib/admin-crud"; import { prisma } from "@/lib/prisma"; export default async function EditUserPage({ params }: { params: Promise<{ userId: string }> }) { const { userId } = await params; const session = await getSession(); if (!session) { redirect("/login"); } const roles = await prisma.role.findMany({ where: { tenantId: session.tenantId, code: { in: [RoleCode.ADMIN_CLIENT, RoleCode.AGENT] } }, orderBy: { code: "asc" } }); const fullUser = await prisma.user.findFirst({ where: { id: userId, tenantId: session.tenantId }, include: { role: true } }); if (!fullUser) { redirect("/team?error=user_not_found"); } return (
Cancel
); }