mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
21 lines
608 B
TypeScript
21 lines
608 B
TypeScript
import { BaseCRUDAPI } from "../_base";
|
|
import { CreateIngredientFood, IngredientFood } from "~/types/api-types/recipe";
|
|
|
|
const prefix = "/api";
|
|
|
|
const routes = {
|
|
food: `${prefix}/foods`,
|
|
foodsFood: (tag: string) => `${prefix}/foods/${tag}`,
|
|
merge: `${prefix}/foods/merge`,
|
|
};
|
|
|
|
export class FoodAPI extends BaseCRUDAPI<CreateIngredientFood, IngredientFood> {
|
|
baseRoute: string = routes.food;
|
|
itemRoute = routes.foodsFood;
|
|
|
|
merge(fromId: string, toId: string) {
|
|
// @ts-ignore TODO: fix this
|
|
return this.requests.put<IngredientFood>(routes.merge, { fromFood: fromId, toFood: toId });
|
|
}
|
|
}
|