feat(api): add story/author count endpoint
This commit is contained in:
parent
60b802b602
commit
6409f4d646
10
server/api/totals.get.ts
Normal file
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}
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user