mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
Feature/automated meal planner (#939)
* cleanup oversized buttons * add get all by category function to reciep repos * fix shopping-list can_merge logic * use randomized data for testing * add random getter to repository for meal-planner * add stub route for random meals * cleanup global namespace * add rules database type * fix type * add plan rules schema * test plan rules methods * add mealplan rules controller * add new repository * update frontend types * formatting * fix regression * update autogenerated types * add api class for mealplan rules * add tests and fix bugs * fix data returns * proof of concept rules editor * add tag support * remove old group categories * add tag support * implement random by rules api * change snack to sides * remove incorrect typing * split repo for custom methods * fix query and use and_ clause * use repo function * remove old test * update changelog
This commit is contained in:
parent
40d1f586cd
commit
d1024e272d
43 changed files with 1153 additions and 175 deletions
|
@ -1,13 +1,15 @@
|
|||
import { BaseCRUDAPI } from "../_base";
|
||||
import { CreatRandomEntry } from "~/types/api-types/meal-plan";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
mealplan: `${prefix}/groups/mealplans`,
|
||||
random: `${prefix}/groups/mealplans/random`,
|
||||
mealplanId: (id: string | number) => `${prefix}/groups/mealplans/${id}`,
|
||||
};
|
||||
|
||||
type PlanEntryType = "breakfast" | "lunch" | "dinner" | "snack";
|
||||
type PlanEntryType = "breakfast" | "lunch" | "dinner" | "side";
|
||||
|
||||
export interface CreateMealPlan {
|
||||
date: string;
|
||||
|
@ -29,4 +31,9 @@ export interface MealPlan extends UpdateMealPlan {
|
|||
export class MealPlanAPI extends BaseCRUDAPI<MealPlan, CreateMealPlan> {
|
||||
baseRoute = routes.mealplan;
|
||||
itemRoute = routes.mealplanId;
|
||||
|
||||
async setRandom(payload: CreatRandomEntry) {
|
||||
console.log(payload);
|
||||
return await this.requests.post<MealPlan>(routes.random, payload);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue