From 34cfa31fe963b4159487d4df9f11c3571c93bd19 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Sat, 23 Apr 2022 00:18:53 +0400 Subject: [PATCH] fix: getFrontpage query --- src/backend/frontpage.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend/frontpage.ts b/src/backend/frontpage.ts index 3d41e93..e50ab0f 100644 --- a/src/backend/frontpage.ts +++ b/src/backend/frontpage.ts @@ -3,14 +3,13 @@ import { Question } from "@prisma/client"; import { measureTime } from "./utils/measureTime"; export async function getFrontpage(): Promise { - const questions = await prisma.question.findMany({ - where: { - onFrontpage: { - isNot: null, + const questions = ( + await prisma.frontpageId.findMany({ + include: { + question: true, }, - }, - }); - console.log(questions.length); + }) + ).map((f) => f.question); return questions; }