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,
	};
});
