mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-11 07:37:14 -07:00
fix: Bulk Add Recipes to Shopping List (#5054)
This commit is contained in:
parent
3d1b76bcad
commit
716c85cc3b
13 changed files with 306 additions and 77 deletions
|
@ -1,7 +1,7 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { RecipeIngredient } from "../types/recipe";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
import {
|
||||
ShoppingListAddRecipeParamsBulk,
|
||||
ShoppingListCreate,
|
||||
ShoppingListItemCreate,
|
||||
ShoppingListItemOut,
|
||||
|
@ -16,7 +16,7 @@ const prefix = "/api";
|
|||
const routes = {
|
||||
shoppingLists: `${prefix}/households/shopping/lists`,
|
||||
shoppingListsId: (id: string) => `${prefix}/households/shopping/lists/${id}`,
|
||||
shoppingListIdAddRecipe: (id: string, recipeId: string) => `${prefix}/households/shopping/lists/${id}/recipe/${recipeId}`,
|
||||
shoppingListIdAddRecipe: (id: string) => `${prefix}/households/shopping/lists/${id}/recipe`,
|
||||
shoppingListIdRemoveRecipe: (id: string, recipeId: string) => `${prefix}/households/shopping/lists/${id}/recipe/${recipeId}/delete`,
|
||||
shoppingListIdUpdateLabelSettings: (id: string) => `${prefix}/households/shopping/lists/${id}/label-settings`,
|
||||
|
||||
|
@ -29,8 +29,8 @@ export class ShoppingListsApi extends BaseCRUDAPI<ShoppingListCreate, ShoppingLi
|
|||
baseRoute = routes.shoppingLists;
|
||||
itemRoute = routes.shoppingListsId;
|
||||
|
||||
async addRecipe(itemId: string, recipeId: string, recipeIncrementQuantity = 1, recipeIngredients: RecipeIngredient[] | null = null) {
|
||||
return await this.requests.post(routes.shoppingListIdAddRecipe(itemId, recipeId), { recipeIncrementQuantity, recipeIngredients });
|
||||
async addRecipes(itemId: string, data: ShoppingListAddRecipeParamsBulk[]) {
|
||||
return await this.requests.post(routes.shoppingListIdAddRecipe(itemId), data);
|
||||
}
|
||||
|
||||
async removeRecipe(itemId: string, recipeId: string, recipeDecrementQuantity = 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue