fix: getFrontpage query

This commit is contained in:
Vyacheslav Matyukhin 2022-04-23 00:18:53 +04:00
parent b258afe16d
commit 34cfa31fe9
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C

View File

@ -3,14 +3,13 @@ import { Question } from "@prisma/client";
import { measureTime } from "./utils/measureTime"; import { measureTime } from "./utils/measureTime";
export async function getFrontpage(): Promise<Question[]> { export async function getFrontpage(): Promise<Question[]> {
const questions = await prisma.question.findMany({ const questions = (
where: { await prisma.frontpageId.findMany({
onFrontpage: { include: {
isNot: null, question: true,
}, },
}, })
}); ).map((f) => f.question);
console.log(questions.length);
return questions; return questions;
} }