7afdd5b577
* feat(frontend): ✨ add back support for assets * feat(backend): ✨ add back support for assets * feat(frontend): ✨ add support for recipe tools * feat(backend): ✨ add support for recipe tools * feat(frontend): ✨ add onHand support for recipe toosl * feat(backend): ✨ add onHand support for backend * refactor(frontend): ♻️ move items to recipe folder and break apart types * feat(frontend): ✨ add support for recipe comments * feat(backend): ✨ Add support for recipe comments * fix(backend): 💥 disable comments import * fix(frontend): 🐛 fix rendering issue with titles when moving steps * add tools to changelog * fix type errors Co-authored-by: hay-kot <hay-kot@pm.me>
19 lines
576 B
TypeScript
19 lines
576 B
TypeScript
import { RecipeComment, RecipeCommentCreate } from "./types";
|
|
import { BaseCRUDAPI } from "~/api/_base";
|
|
|
|
const prefix = "/api";
|
|
|
|
const routes = {
|
|
comment: `${prefix}/comments`,
|
|
byRecipe: (id: string) => `${prefix}/recipes/${id}/comments`,
|
|
commentsId: (id: string) => `${prefix}/comments/${id}`,
|
|
};
|
|
|
|
export class CommentsApi extends BaseCRUDAPI<RecipeComment, RecipeCommentCreate> {
|
|
baseRoute: string = routes.comment;
|
|
itemRoute = routes.commentsId;
|
|
|
|
async byRecipe(slug: string) {
|
|
return await this.requests.get<RecipeComment[]>(routes.byRecipe(slug));
|
|
}
|
|
}
|