diff --git a/app/components/RestaurantCard.tsx b/app/components/RestaurantCard.tsx
index c62d5fb..67bbf4a 100644
--- a/app/components/RestaurantCard.tsx
+++ b/app/components/RestaurantCard.tsx
@@ -1,24 +1,29 @@
import Link from "next/link";
+import { RestaurantCardType } from "../page";
-export default function RestaurantCard() {
+interface Props {
+ restaurant: RestaurantCardType;
+}
+
+export default function RestaurantCard({restaurant}: Props) {
return (
-
+
-
Milestones Grill
+
{restaurant.name}
-
Mexican
+
{restaurant.cuisine.name}
$$$$
-
Toronto
+
{restaurant.location.name}
Booked 3 times today
diff --git a/app/page.tsx b/app/page.tsx
index 284ac73..8950793 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,12 +1,41 @@
import Header from "./components/Header";
import RestaurantCard from "./components/RestaurantCard";
+import { PrismaClient, Cuisine, Location, PRICE } from '@prisma/client';
-export default function Home() {
+export interface RestaurantCardType {
+ id: number;
+ name: string;
+ main_image: string;
+ cuisine: Cuisine;
+ location: Location;
+ price: PRICE;
+ slug: string;
+}
+const prisma = new PrismaClient();
+
+const fetchRestaurants = async (): Promise
=> {
+ const restaurants = await prisma.restaurant.findMany({
+ select: {
+ id: true,
+ name: true,
+ main_image: true,
+ cuisine: true,
+ location: true,
+ price: true,
+ slug: true
+ }
+ });
+ return restaurants;
+}
+
+export default async function Home() {
+ const restaurants = await fetchRestaurants();
+ console.log({restaurants})
return (
-
+ {restaurants.map(restaurant => )}
);