diff --git a/src/pages/api/dashboard-by-id.ts b/src/pages/api/dashboard-by-id.ts deleted file mode 100644 index c79734f..0000000 --- a/src/pages/api/dashboard-by-id.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { NextApiRequest, NextApiResponse } from "next/types"; - -import { pgGetByIds } from "../../backend/database/pg-wrapper"; - -export default async function handler( - req: NextApiRequest, - res: NextApiResponse -) { - if (req.method !== "POST") { - res.status(400).send("Expected POST request"); - return; - } - - console.log(req.body); - let id = req.body.id; - console.log(id); - let dashboardItemArray = await pgGetByIds({ - ids: [id], - table: "dashboards", - }); - if (!!dashboardItemArray && dashboardItemArray.length > 0) { - let dashboardItem = dashboardItemArray[0]; - console.log(dashboardItem); - let dashboardContents = await pgGetByIds({ - ids: dashboardItem.contents, - table: "questions", - }); - res.status(200).send({ - dashboardContents, - dashboardItem, - }); - } else { - res.status(404).send({ error: `Dashboard not found with id ${id}` }); - } -} diff --git a/src/pages/api/frontpage.ts b/src/pages/api/frontpage.ts deleted file mode 100644 index 0611498..0000000 --- a/src/pages/api/frontpage.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NextApiRequest, NextApiResponse } from "next/types"; - -import { getFrontpage } from "../../backend/frontpage"; - -export default async function handler( - req: NextApiRequest, - res: NextApiResponse -) { - let frontpageElements = await getFrontpage(); - res.status(200).json(frontpageElements); -} diff --git a/src/pages/api/questions.ts b/src/pages/api/questions.ts deleted file mode 100644 index 837e009..0000000 --- a/src/pages/api/questions.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NextApiRequest, NextApiResponse } from "next/types"; - -import { pgRead } from "../../backend/database/pg-wrapper"; - -export default async function handler( - req: NextApiRequest, - res: NextApiResponse -) { - let allQuestions = await pgRead({ tableName: "questions" }); - console.log(allQuestions.map((element) => element.title).slice(0, 5)); - console.log("..."); - res.status(200).json(allQuestions); -}