import React from 'react';
import { prisma } from '@/app/lib/prisma';
import ItemManager from './ItemManager';

export const dynamic = 'force-dynamic';

export default async function AdminItemsPage() {
  const items = await prisma.item.findMany({
    include: {
      category: true
    },
    orderBy: { createdAt: 'desc' }
  });

  const categories = await prisma.category.findMany({
    orderBy: { title: 'asc' }
  });

  return <ItemManager items={items} categories={categories} />;
}
