feat(api): add endpoint to get all non-hidden stories a user has written

This commit is contained in:
parent 79f5f2cc10
commit 8bf78a0494
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -0,0 +1,11 @@
import listQuerier from "~/lib/server/dbHelpers/listQuerier";
export default cachedEventHandler(async (ev) => {
const id = parseInt(getRouterParam(ev, "id")!);
let s = await listQuerier({ author: { $in: [id] } }, ev.context);
const t = s.map((a) => a.toObject());
return {
stories: t,
total: t.length,
};
});