feat: Move "on hand" and "last made" to household (#4616)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
Michael Genson
2025-01-13 10:19:49 -06:00
committed by GitHub
parent e565b919df
commit e9892aba89
53 changed files with 1618 additions and 400 deletions

View File

@@ -161,7 +161,7 @@ export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
householdsWithTool?: string[];
[k: string]: unknown;
}
export interface CustomPageImport {

View File

@@ -97,7 +97,7 @@ export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
householdsWithTool?: string[];
[k: string]: unknown;
}
export interface SaveCookBook {

View File

@@ -208,6 +208,27 @@ export interface ReadWebhook {
householdId: string;
id: string;
}
export interface HouseholdRecipeBase {
lastMade?: string | null;
}
export interface HouseholdRecipeCreate {
lastMade?: string | null;
householdId: string;
recipeId: string;
}
export interface HouseholdRecipeOut {
lastMade?: string | null;
householdId: string;
recipeId: string;
id: string;
}
export interface HouseholdRecipeSummary {
lastMade?: string | null;
recipeId: string;
}
export interface HouseholdRecipeUpdate {
lastMade?: string | null;
}
export interface HouseholdSave {
groupId: string;
name: string;
@@ -297,7 +318,6 @@ export interface IngredientUnit {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
@@ -318,7 +338,6 @@ export interface CreateIngredientUnit {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
@@ -338,9 +357,9 @@ export interface IngredientFood {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: IngredientFoodAlias[];
householdsWithIngredientFood?: string[];
label?: MultiPurposeLabelSummary | null;
createdAt?: string | null;
updatedAt?: string | null;
@@ -363,9 +382,9 @@ export interface CreateIngredientFood {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: CreateIngredientFoodAlias[];
householdsWithIngredientFood?: string[];
[k: string]: unknown;
}
export interface CreateIngredientFoodAlias {
@@ -592,7 +611,7 @@ export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
householdsWithTool?: string[];
[k: string]: unknown;
}
export interface ShoppingListRemoveRecipeParams {

View File

@@ -117,7 +117,7 @@ export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
householdsWithTool?: string[];
[k: string]: unknown;
}
export interface SavePlanEntry {

View File

@@ -64,9 +64,9 @@ export interface CreateIngredientFood {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: CreateIngredientFoodAlias[];
householdsWithIngredientFood?: string[];
}
export interface CreateIngredientFoodAlias {
name: string;
@@ -79,7 +79,6 @@ export interface CreateIngredientUnit {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
@@ -136,9 +135,9 @@ export interface IngredientFood {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: IngredientFoodAlias[];
householdsWithIngredientFood?: string[];
label?: MultiPurposeLabelSummary | null;
createdAt?: string | null;
updatedAt?: string | null;
@@ -167,7 +166,6 @@ export interface IngredientUnit {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
@@ -262,7 +260,7 @@ export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
householdsWithTool?: string[];
}
export interface RecipeStep {
id?: string | null;
@@ -447,24 +445,24 @@ export interface RecipeTimelineEventUpdate {
}
export interface RecipeToolCreate {
name: string;
onHand?: boolean;
householdsWithTool?: string[];
}
export interface RecipeToolOut {
name: string;
onHand?: boolean;
householdsWithTool?: string[];
id: string;
slug: string;
}
export interface RecipeToolResponse {
name: string;
onHand?: boolean;
householdsWithTool?: string[];
id: string;
slug: string;
recipes?: RecipeSummary[];
}
export interface RecipeToolSave {
name: string;
onHand?: boolean;
householdsWithTool?: string[];
groupId: string;
}
export interface RecipeZipTokenResponse {
@@ -478,9 +476,9 @@ export interface SaveIngredientFood {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: CreateIngredientFoodAlias[];
householdsWithIngredientFood?: string[];
groupId: string;
}
export interface SaveIngredientUnit {
@@ -491,7 +489,6 @@ export interface SaveIngredientUnit {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
@@ -536,7 +533,6 @@ export interface UnitFoodBase {
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
}
export interface UpdateImageResponse {
image: string;

View File

@@ -11,6 +11,7 @@ import {
CreateInviteToken,
ReadInviteToken,
HouseholdSummary,
HouseholdRecipeSummary,
} from "~/lib/api/types/household";
const prefix = "/api";
@@ -26,6 +27,7 @@ const routes = {
invitation: `${prefix}/households/invitations`,
householdsId: (id: string | number) => `${prefix}/groups/households/${id}`,
householdsSelfRecipesSlug: (recipeSlug: string) => `${prefix}/households/self/recipes/${recipeSlug}`,
};
export class HouseholdAPI extends BaseCRUDAPIReadOnly<HouseholdSummary> {
@@ -37,6 +39,10 @@ export class HouseholdAPI extends BaseCRUDAPIReadOnly<HouseholdSummary> {
return await this.requests.get<HouseholdInDB>(routes.householdsSelf);
}
async getCurrentUserHouseholdRecipe(recipeSlug: string) {
return await this.requests.get<HouseholdRecipeSummary>(routes.householdsSelfRecipesSlug(recipeSlug));
}
async getPreferences() {
return await this.requests.get<ReadHouseholdPreferences>(routes.preferences);
}