fix: cleanup seed and fetch latest restaurant

This commit is contained in:
AyrisAI
2026-05-15 20:40:23 +03:00
parent 4fbfd39736
commit 6169742476
2 changed files with 21 additions and 5 deletions

View File

@@ -5,7 +5,8 @@ export const dynamic = 'force-dynamic';
export default async function Page() {
try {
const restaurant = await prisma.restaurant.findFirst({
const restaurant = await (prisma as any).restaurant.findFirst({
orderBy: { createdAt: 'desc' },
include: {
categories: {
include: {
@@ -48,6 +49,18 @@ export default async function Page() {
})),
};
if (data.categories.length === 0) {
return (
<div style={{ background: '#000', color: '#fff', height: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', textAlign: 'center', padding: '20px' }}>
<div>
<h1 style={{ color: 'var(--gold)' }}>LUNA</h1>
<p>Restoran bulundu ancak henüz hiç kategori eklenmemiş.</p>
<p style={{ fontSize: '0.8rem', color: '#666' }}>Lütfen admin panelinden kategori ve ürün ekleyin.</p>
</div>
</div>
);
}
return <MenuView data={data} />;
} catch (error: any) {
console.error("Database error:", error);