mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
feat: Query Filter Builder for Cookbooks and Meal Plans (#4346)
This commit is contained in:
parent
2a9a6fa5e6
commit
b8e62ab8dd
47 changed files with 2043 additions and 440 deletions
|
@ -5,34 +5,17 @@
|
|||
/* Do not modify it by hand - just update the pydantic models and then re-run the script
|
||||
*/
|
||||
|
||||
export type LogicalOperator = "AND" | "OR";
|
||||
export type RelationalKeyword = "IS" | "IS NOT" | "IN" | "NOT IN" | "CONTAINS ALL" | "LIKE" | "NOT LIKE";
|
||||
export type RelationalOperator = "=" | "<>" | ">" | "<" | ">=" | "<=";
|
||||
|
||||
export interface CreateCookBook {
|
||||
name: string;
|
||||
description?: string;
|
||||
slug?: string | null;
|
||||
position?: number;
|
||||
public?: boolean;
|
||||
categories?: CategoryBase[];
|
||||
tags?: TagBase[];
|
||||
tools?: RecipeTool[];
|
||||
requireAllCategories?: boolean;
|
||||
requireAllTags?: boolean;
|
||||
requireAllTools?: boolean;
|
||||
}
|
||||
export interface CategoryBase {
|
||||
name: string;
|
||||
id: string;
|
||||
slug: string;
|
||||
}
|
||||
export interface TagBase {
|
||||
name: string;
|
||||
id: string;
|
||||
slug: string;
|
||||
}
|
||||
export interface RecipeTool {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
onHand?: boolean;
|
||||
queryFilterString: string;
|
||||
}
|
||||
export interface ReadCookBook {
|
||||
name: string;
|
||||
|
@ -40,15 +23,23 @@ export interface ReadCookBook {
|
|||
slug?: string | null;
|
||||
position?: number;
|
||||
public?: boolean;
|
||||
categories?: CategoryBase[];
|
||||
tags?: TagBase[];
|
||||
tools?: RecipeTool[];
|
||||
requireAllCategories?: boolean;
|
||||
requireAllTags?: boolean;
|
||||
requireAllTools?: boolean;
|
||||
queryFilterString: string;
|
||||
groupId: string;
|
||||
householdId: string;
|
||||
id: string;
|
||||
queryFilter: QueryFilterJSON;
|
||||
}
|
||||
export interface QueryFilterJSON {
|
||||
parts?: QueryFilterJSONPart[];
|
||||
}
|
||||
export interface QueryFilterJSONPart {
|
||||
leftParenthesis?: string | null;
|
||||
rightParenthesis?: string | null;
|
||||
logicalOperator?: LogicalOperator | null;
|
||||
attributeName?: string | null;
|
||||
relationalOperator?: RelationalKeyword | RelationalOperator | null;
|
||||
value?: string | string[] | null;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RecipeCookBook {
|
||||
name: string;
|
||||
|
@ -56,15 +47,11 @@ export interface RecipeCookBook {
|
|||
slug?: string | null;
|
||||
position?: number;
|
||||
public?: boolean;
|
||||
categories?: CategoryBase[];
|
||||
tags?: TagBase[];
|
||||
tools?: RecipeTool[];
|
||||
requireAllCategories?: boolean;
|
||||
requireAllTags?: boolean;
|
||||
requireAllTools?: boolean;
|
||||
queryFilterString: string;
|
||||
groupId: string;
|
||||
householdId: string;
|
||||
id: string;
|
||||
queryFilter: QueryFilterJSON;
|
||||
recipes: RecipeSummary[];
|
||||
}
|
||||
export interface RecipeSummary {
|
||||
|
@ -104,18 +91,20 @@ export interface RecipeTag {
|
|||
slug: string;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface RecipeTool {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
onHand?: boolean;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface SaveCookBook {
|
||||
name: string;
|
||||
description?: string;
|
||||
slug?: string | null;
|
||||
position?: number;
|
||||
public?: boolean;
|
||||
categories?: CategoryBase[];
|
||||
tags?: TagBase[];
|
||||
tools?: RecipeTool[];
|
||||
requireAllCategories?: boolean;
|
||||
requireAllTags?: boolean;
|
||||
requireAllTools?: boolean;
|
||||
queryFilterString: string;
|
||||
groupId: string;
|
||||
householdId: string;
|
||||
}
|
||||
|
@ -125,12 +114,7 @@ export interface UpdateCookBook {
|
|||
slug?: string | null;
|
||||
position?: number;
|
||||
public?: boolean;
|
||||
categories?: CategoryBase[];
|
||||
tags?: TagBase[];
|
||||
tools?: RecipeTool[];
|
||||
requireAllCategories?: boolean;
|
||||
requireAllTags?: boolean;
|
||||
requireAllTools?: boolean;
|
||||
queryFilterString: string;
|
||||
groupId: string;
|
||||
householdId: string;
|
||||
id: string;
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
export type PlanEntryType = "breakfast" | "lunch" | "dinner" | "side";
|
||||
export type PlanRulesDay = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | "unset";
|
||||
export type PlanRulesType = "breakfast" | "lunch" | "dinner" | "side" | "unset";
|
||||
export type LogicalOperator = "AND" | "OR";
|
||||
export type RelationalKeyword = "IS" | "IS NOT" | "IN" | "NOT IN" | "CONTAINS ALL" | "LIKE" | "NOT LIKE";
|
||||
export type RelationalOperator = "=" | "<>" | ">" | "<" | ">=" | "<=";
|
||||
|
||||
export interface Category {
|
||||
id: string;
|
||||
|
@ -31,44 +34,36 @@ export interface ListItem {
|
|||
quantity?: number;
|
||||
checked?: boolean;
|
||||
}
|
||||
export interface PlanCategory {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
}
|
||||
export interface PlanHousehold {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
}
|
||||
export interface PlanRulesCreate {
|
||||
day?: PlanRulesDay & string;
|
||||
entryType?: PlanRulesType & string;
|
||||
categories?: PlanCategory[];
|
||||
tags?: PlanTag[];
|
||||
households?: PlanHousehold[];
|
||||
}
|
||||
export interface PlanTag {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
queryFilterString: string;
|
||||
}
|
||||
export interface PlanRulesOut {
|
||||
day?: PlanRulesDay & string;
|
||||
entryType?: PlanRulesType & string;
|
||||
categories?: PlanCategory[];
|
||||
tags?: PlanTag[];
|
||||
households?: PlanHousehold[];
|
||||
queryFilterString: string;
|
||||
groupId: string;
|
||||
householdId: string;
|
||||
id: string;
|
||||
queryFilter: QueryFilterJSON;
|
||||
}
|
||||
export interface QueryFilterJSON {
|
||||
parts?: QueryFilterJSONPart[];
|
||||
}
|
||||
export interface QueryFilterJSONPart {
|
||||
leftParenthesis?: string | null;
|
||||
rightParenthesis?: string | null;
|
||||
logicalOperator?: LogicalOperator | null;
|
||||
attributeName?: string | null;
|
||||
relationalOperator?: RelationalKeyword | RelationalOperator | null;
|
||||
value?: string | string[] | null;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface PlanRulesSave {
|
||||
day?: PlanRulesDay & string;
|
||||
entryType?: PlanRulesType & string;
|
||||
categories?: PlanCategory[];
|
||||
tags?: PlanTag[];
|
||||
households?: PlanHousehold[];
|
||||
queryFilterString: string;
|
||||
groupId: string;
|
||||
householdId: string;
|
||||
}
|
||||
|
@ -126,6 +121,7 @@ export interface RecipeTool {
|
|||
name: string;
|
||||
slug: string;
|
||||
onHand?: boolean;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface SavePlanEntry {
|
||||
date: string;
|
||||
|
|
|
@ -24,10 +24,17 @@ export interface PaginationData<T> {
|
|||
items: T[];
|
||||
}
|
||||
|
||||
export type RecipeOrganizer = "categories" | "tags" | "tools";
|
||||
export type RecipeOrganizer =
|
||||
| "categories"
|
||||
| "tags"
|
||||
| "tools"
|
||||
| "foods"
|
||||
| "households";
|
||||
|
||||
export enum Organizer {
|
||||
Category = "categories",
|
||||
Tag = "tags",
|
||||
Tool = "tools",
|
||||
Food = "foods",
|
||||
Household = "households",
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
export type OrderByNullPosition = "first" | "last";
|
||||
export type OrderDirection = "asc" | "desc";
|
||||
export type LogicalOperator = "AND" | "OR";
|
||||
export type RelationalKeyword = "IS" | "IS NOT" | "IN" | "NOT IN" | "CONTAINS ALL" | "LIKE" | "NOT LIKE";
|
||||
export type RelationalOperator = "=" | "<>" | ">" | "<" | ">=" | "<=";
|
||||
|
||||
export interface ErrorResponse {
|
||||
message: string;
|
||||
|
@ -25,6 +28,17 @@ export interface PaginationQuery {
|
|||
queryFilter?: string | null;
|
||||
paginationSeed?: string | null;
|
||||
}
|
||||
export interface QueryFilterJSON {
|
||||
parts?: QueryFilterJSONPart[];
|
||||
}
|
||||
export interface QueryFilterJSONPart {
|
||||
leftParenthesis?: string | null;
|
||||
rightParenthesis?: string | null;
|
||||
logicalOperator?: LogicalOperator | null;
|
||||
attributeName?: string | null;
|
||||
relationalOperator?: RelationalKeyword | RelationalOperator | null;
|
||||
value?: string | string[] | null;
|
||||
}
|
||||
export interface RecipeSearchQuery {
|
||||
cookbook?: string | null;
|
||||
requireAllCategories?: boolean;
|
||||
|
|
|
@ -14,7 +14,6 @@ export class MealPlanAPI extends BaseCRUDAPI<CreatePlanEntry, ReadPlanEntry, Upd
|
|||
itemRoute = routes.mealplanId;
|
||||
|
||||
async setRandom(payload: CreateRandomEntry) {
|
||||
console.log(payload);
|
||||
return await this.requests.post<ReadPlanEntry>(routes.random, payload);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue