From 7827aa119f001f15db44652ba59b9ffb06c4dbf4 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 28 Nov 2022 19:30:12 +0100 Subject: [PATCH] =?UTF-8?q?add=20:=20page=20tout=20savoir=20r=C3=A9cup?= =?UTF-8?q?=C3=A9ration=20des=20produits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/tout-savoir.tsx | 103 ++++++++++++++++++------------------------ prisma/schema.prisma | 2 +- 2 files changed, 44 insertions(+), 61 deletions(-) diff --git a/pages/tout-savoir.tsx b/pages/tout-savoir.tsx index da818f1..d8b2c1f 100644 --- a/pages/tout-savoir.tsx +++ b/pages/tout-savoir.tsx @@ -5,11 +5,34 @@ import style from '../styles/ToutSavoir.module.css' import test from '../public/images/coffret-the-PhotoRoom.webp'; +import prisma from "../lib/prisma"; -const ToutSavoir = () => { +export async function getStaticProps() { + const produits = await prisma.produit.findMany(); + + return { + props: { + produits, + }, + } +} + +type Props = { + produits: Produit[]; +} + +type Produit = { + id: number; + actif: boolean; + nomProduit: string; + prixTtc: number; +} + +const ToutSavoir = ({ produits }: Props) => { + console.log('p', produits); return ( - <> + <> Tout savoir @@ -21,73 +44,33 @@ const ToutSavoir = () => { - {/* backgroundImagePath={'/images/ugh.png'} */} -
-

Tout savoir sur le jeu concours

-
-

- Le jeu concours vous est proposé à l'occasion de ... -

-
-
-
- produit -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

-
-
-
-
-
- produit -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

-
-
-
-
-
- produit -
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

-
-
-
-
-
+ {/* backgroundImagePath={'/images/ugh.png'} */} +
+

Tout savoir sur le jeu concours

+
+

+ Le jeu concours vous est proposé à l'occasion de ... +

+
+ {produits.map((produit: Produit) => { + return
+
produit
-
Card title
+
{produit.nomProduit}

Some quick example text to build on the card title and make up the bulk of the card's content.

-
+ })}
+
); }; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 279d769..a0b2ccb 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -93,7 +93,7 @@ model Produit { id Int @id @default(autoincrement()) actif Boolean? nomProduit String? - prixTtc Decimal? + prixTtc Int? refGain Gain[] }