import { prisma } from "@/lib/prisma";
import MachinesClient from "./MachinesClient";

export const dynamic = "force-dynamic";

export default async function AdminMachinesPage() {
  const machines = await prisma.machine.findMany({
    orderBy: [{ active: "desc" }, { name: "asc" }],
  });
  return (
    <MachinesClient
      initial={machines.map((m) => ({ ...m, createdAt: m.createdAt.toISOString(), updatedAt: m.updatedAt.toISOString() }))}
    />
  );
}
