From b5454e93632b4124f0be46396df79fde2894bf73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Wed, 6 Dec 2023 21:38:30 -0500 Subject: [PATCH] feat(api): add endpoint to fetch latest stories --- server/api/latest.get.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 server/api/latest.get.ts diff --git a/server/api/latest.get.ts b/server/api/latest.get.ts new file mode 100644 index 0000000..5dc848e --- /dev/null +++ b/server/api/latest.get.ts @@ -0,0 +1,11 @@ +import listQuerier from "~/lib/server/dbHelpers/listQuerier"; +import { Story } from "~/models/stories"; +import { log } from "~/lib/server/logger"; + +export default eventHandler(async (ev) => { + const s = await listQuerier({}, ev.context, ev, 20, { + "chapters.posted": -1, + }); + log.debug("s=>", { label: "fucking aids" }); + return s; +});