feat(api): add dedicated route to fetch user's own stories

This commit is contained in:
parent f86f46eb50
commit c795e5d293
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -0,0 +1,11 @@
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,
};
});