feat: Add snack, drink, and dessert (#6149)

Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
Co-authored-by: Michael Genson <genson.michael@gmail.com>
This commit is contained in:
Cash Prokop-Weaver
2025-12-05 09:54:00 -08:00
committed by GitHub
parent c115e6d83f
commit 6695314588
10 changed files with 54 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@@ -58,6 +58,9 @@ const MEAL_TYPE_OPTIONS = [
{ title: i18n.t("meal-plan.lunch"), value: "lunch" }, { title: i18n.t("meal-plan.lunch"), value: "lunch" },
{ title: i18n.t("meal-plan.dinner"), value: "dinner" }, { title: i18n.t("meal-plan.dinner"), value: "dinner" },
{ title: i18n.t("meal-plan.side"), value: "side" }, { title: i18n.t("meal-plan.side"), value: "side" },
{ title: i18n.t("meal-plan.snack"), value: "snack" },
{ title: i18n.t("meal-plan.drink"), value: "drink" },
{ title: i18n.t("meal-plan.dessert"), value: "dessert" },
{ title: i18n.t("meal-plan.type-any"), value: "unset" }, { title: i18n.t("meal-plan.type-any"), value: "unset" },
]; ];

View File

@@ -15,6 +15,9 @@ export function usePlanTypeOptions() {
{ text: i18n.t("meal-plan.lunch"), value: "lunch" }, { text: i18n.t("meal-plan.lunch"), value: "lunch" },
{ text: i18n.t("meal-plan.dinner"), value: "dinner" }, { text: i18n.t("meal-plan.dinner"), value: "dinner" },
{ text: i18n.t("meal-plan.side"), value: "side" }, { text: i18n.t("meal-plan.side"), value: "side" },
{ text: i18n.t("meal-plan.snack"), value: "snack" },
{ text: i18n.t("meal-plan.drink"), value: "drink" },
{ text: i18n.t("meal-plan.dessert"), value: "dessert" },
] as PlanOption[]; ] as PlanOption[];
} }

View File

@@ -342,6 +342,9 @@
"breakfast": "Breakfast", "breakfast": "Breakfast",
"lunch": "Lunch", "lunch": "Lunch",
"dinner": "Dinner", "dinner": "Dinner",
"snack": "Snack",
"drink": "Drink",
"dessert": "Dessert",
"type-any": "Any", "type-any": "Any",
"day-any": "Any", "day-any": "Any",
"editor": "Editor", "editor": "Editor",

View File

@@ -5,9 +5,9 @@
/* Do not modify it by hand - just update the pydantic models and then re-run the script /* Do not modify it by hand - just update the pydantic models and then re-run the script
*/ */
export type PlanEntryType = "breakfast" | "lunch" | "dinner" | "side"; export type PlanEntryType = "breakfast" | "lunch" | "dinner" | "side" | "snack" | "drink" | "dessert";
export type PlanRulesDay = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | "unset"; export type PlanRulesDay = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | "unset";
export type PlanRulesType = "breakfast" | "lunch" | "dinner" | "side" | "unset"; export type PlanRulesType = "breakfast" | "lunch" | "dinner" | "side" | "snack" | "drink" | "dessert" | "unset";
export type LogicalOperator = "AND" | "OR"; export type LogicalOperator = "AND" | "OR";
export type RelationalKeyword = "IS" | "IS NOT" | "IN" | "NOT IN" | "CONTAINS ALL" | "LIKE" | "NOT LIKE"; export type RelationalKeyword = "IS" | "IS NOT" | "IN" | "NOT IN" | "CONTAINS ALL" | "LIKE" | "NOT LIKE";
export type RelationalOperator = "=" | "<>" | ">" | "<" | ">=" | "<="; export type RelationalOperator = "=" | "<>" | ">" | "<" | ">=" | "<=";
@@ -53,7 +53,6 @@ export interface QueryFilterJSONPart {
attributeName?: string | null; attributeName?: string | null;
relationalOperator?: RelationalKeyword | RelationalOperator | null; relationalOperator?: RelationalKeyword | RelationalOperator | null;
value?: string | string[] | null; value?: string | string[] | null;
[k: string]: unknown;
} }
export interface PlanRulesSave { export interface PlanRulesSave {
day?: PlanRulesDay; day?: PlanRulesDay;
@@ -106,14 +105,12 @@ export interface RecipeCategory {
groupId?: string | null; groupId?: string | null;
name: string; name: string;
slug: string; slug: string;
[k: string]: unknown;
} }
export interface RecipeTag { export interface RecipeTag {
id?: string | null; id?: string | null;
groupId?: string | null; groupId?: string | null;
name: string; name: string;
slug: string; slug: string;
[k: string]: unknown;
} }
export interface RecipeTool { export interface RecipeTool {
id: string; id: string;
@@ -121,7 +118,6 @@ export interface RecipeTool {
name: string; name: string;
slug: string; slug: string;
householdsWithTool?: string[]; householdsWithTool?: string[];
[k: string]: unknown;
} }
export interface SavePlanEntry { export interface SavePlanEntry {
date: string; date: string;

View File

@@ -178,6 +178,26 @@
text: $t('meal-plan.lunch'), text: $t('meal-plan.lunch'),
event: 'randomLunch', event: 'randomLunch',
}, },
{
icon: $globals.icons.diceMultiple,
text: $t('meal-plan.side'),
event: 'randomSide',
},
{
icon: $globals.icons.diceMultiple,
text: $t('meal-plan.snack'),
event: 'randomSnack',
},
{
icon: $globals.icons.diceMultiple,
text: $t('meal-plan.drink'),
event: 'randomDrink',
},
{
icon: $globals.icons.diceMultiple,
text: $t('meal-plan.dessert'),
event: 'randomDessert',
},
], ],
}, },
{ {
@@ -201,6 +221,9 @@
@random-lunch="randomMeal(plan.date, 'lunch')" @random-lunch="randomMeal(plan.date, 'lunch')"
@random-dinner="randomMeal(plan.date, 'dinner')" @random-dinner="randomMeal(plan.date, 'dinner')"
@random-side="randomMeal(plan.date, 'side')" @random-side="randomMeal(plan.date, 'side')"
@random-snack="randomMeal(plan.date, 'snack')"
@random-drink="randomMeal(plan.date, 'drink')"
@random-dessert="randomMeal(plan.date, 'dessert')"
/> />
</div> </div>
</v-col> </v-col>

View File

@@ -83,6 +83,9 @@ const plan = computed<Days[]>(() => {
{ title: i18n.t("meal-plan.lunch"), meals: [] }, { title: i18n.t("meal-plan.lunch"), meals: [] },
{ title: i18n.t("meal-plan.dinner"), meals: [] }, { title: i18n.t("meal-plan.dinner"), meals: [] },
{ title: i18n.t("meal-plan.side"), meals: [] }, { title: i18n.t("meal-plan.side"), meals: [] },
{ title: i18n.t("meal-plan.snack"), meals: [] },
{ title: i18n.t("meal-plan.drink"), meals: [] },
{ title: i18n.t("meal-plan.dessert"), meals: [] },
], ],
recipes: [], recipes: [],
}; };
@@ -100,6 +103,15 @@ const plan = computed<Days[]>(() => {
else if (meal.entryType === "side") { else if (meal.entryType === "side") {
out.sections[3].meals.push(meal); out.sections[3].meals.push(meal);
} }
else if (meal.entryType === "snack") {
out.sections[4].meals.push(meal);
}
else if (meal.entryType === "drink") {
out.sections[5].meals.push(meal);
}
else if (meal.entryType === "dessert") {
out.sections[6].meals.push(meal);
}
if (meal.recipe) { if (meal.recipe) {
out.recipes.push(meal.recipe); out.recipes.push(meal.recipe);

View File

@@ -39,7 +39,7 @@ class GroupMealPlanRules(BaseMixins, SqlAlchemyBase):
) # "MONDAY", "TUESDAY", "WEDNESDAY", etc... ) # "MONDAY", "TUESDAY", "WEDNESDAY", etc...
entry_type: Mapped[str] = mapped_column( entry_type: Mapped[str] = mapped_column(
String, nullable=False, default="" String, nullable=False, default=""
) # "breakfast", "lunch", "dinner", "side" ) # "breakfast", "lunch", "dinner", etc ...
query_filter_string: Mapped[str] = mapped_column(String, nullable=False, default="") query_filter_string: Mapped[str] = mapped_column(String, nullable=False, default="")
# Old filters - deprecated in favor of query filter strings # Old filters - deprecated in favor of query filter strings

View File

@@ -21,6 +21,9 @@ class PlanEntryType(str, Enum):
lunch = "lunch" lunch = "lunch"
dinner = "dinner" dinner = "dinner"
side = "side" side = "side"
snack = "snack"
drink = "drink"
dessert = "dessert"
class CreateRandomEntry(MealieModel): class CreateRandomEntry(MealieModel):

View File

@@ -38,6 +38,9 @@ class PlanRulesType(str, Enum):
lunch = "lunch" lunch = "lunch"
dinner = "dinner" dinner = "dinner"
side = "side" side = "side"
snack = "snack"
drink = "drink"
dessert = "dessert"
unset = "unset" unset = "unset"