☙◦ The Tablet ❀ GamerGirlandCo ◦❧
356cb5ea6b
create endpoints for adding+getting a single chapter's reviews
12 lines
344 B
TypeScript
12 lines
344 B
TypeScript
import storyQuerier from "~/lib/server/dbHelpers/storyQuerier";
|
|
import { Review } from "~/models/stories/review";
|
|
|
|
export default eventHandler(async (ev) => {
|
|
let story = await storyQuerier(ev);
|
|
let comments = await Review.find({
|
|
whichChapter: story.chapters[ev.context.chapterIndex || 0].id,
|
|
replyingTo: null,
|
|
});
|
|
return comments;
|
|
});
|