next/server/api/user/me/stories.get.ts

12 lines
345 B
TypeScript

import { listQuerier } from "@server/dbHelpers";
import { isLoggedIn } from "@server/middlewareButNotReally";
export default cachedEventHandler(async (ev) => {
isLoggedIn(ev);
const id = ev.context.currentUser!._id;
let s = await listQuerier({ author: id }, ev.context, ev);
return {
stories: s.stories,
total: s.stories.length,
};
});