From c632f1a93a387c57c4d40b8df9f1be7afa23cc15 Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Mon, 23 May 2022 13:19:58 +0200 Subject: [PATCH] Add pizzas to restaurant request --- src/controller/restaurants.controller.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/controller/restaurants.controller.ts b/src/controller/restaurants.controller.ts index 4f3ea83..45ae7d9 100644 --- a/src/controller/restaurants.controller.ts +++ b/src/controller/restaurants.controller.ts @@ -81,13 +81,20 @@ export const getRestaurant = async (req: Request, res: Response) => { where: { id: id, }, + include: { + pizzas: true, + } }); res.status(HttpStatusCodes.OK).json(restaurant); }; export const getRestaurants = async (_req: Request, res: Response) => { - const restaurants = await prisma.restaurant.findMany(); + const restaurants = await prisma.restaurant.findMany({ + include: { + pizzas: true + } + }); res.status(HttpStatusCodes.OK).json(restaurants); };