next/server/api/user/[id]/stories.get.ts

11 lines
287 B
TypeScript
Raw Normal View History

import { listQuerier } from "@server/dbHelpers";
export default cachedEventHandler(async (ev) => {
const id = parseInt(getRouterParam(ev, "id")!);
let s = await listQuerier({ author: { $in: [id] } }, ev.context, ev);
return {
stories: s.stories,
total: s.stories.length,
};
});