cleanup: remove unused api endpoints

This commit is contained in:
Vyacheslav Matyukhin 2022-04-19 01:13:36 +03:00
parent 60d3973ea3
commit ba93178e14
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
3 changed files with 0 additions and 59 deletions

View File

@ -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}` });
}
}

View File

@ -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);
}

View File

@ -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);
}