cleanup: remove unused api endpoints
This commit is contained in:
parent
60d3973ea3
commit
ba93178e14
|
@ -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}` });
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user