feat(api): add story/author count endpoint

This commit is contained in:
parent 60b802b602
commit 6409f4d646
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

10
server/api/totals.get.ts Normal file

@ -0,0 +1,10 @@
import mongoose from "mongoose";
import { Story } from "~/models/stories";
export default eventHandler(async (event) => {
let aa = mongoose.connection.db.collection("z_index_totAuthors");
let totalStories = await Story.countDocuments({"chapters.hidden": false});
let totalAuthors = await aa.countDocuments();
return {stories: totalStories, authors: totalAuthors}
})