mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-04-09 22:45:36 -04:00
chore: Nuxt 4 upgrade (#7426)
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
import { BaseAPI } from "../base/base-clients";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
import { PublicRecipeApi } from "./explore/recipes";
|
||||
import { PublicFoodsApi } from "./explore/foods";
|
||||
import { PublicCategoriesApi, PublicTagsApi, PublicToolsApi } from "./explore/organizers";
|
||||
import { PublicCookbooksApi } from "./explore/cookbooks";
|
||||
import { PublicHouseholdApi } from "./explore/households";
|
||||
|
||||
export class ExploreApi extends BaseAPI {
|
||||
public recipes: PublicRecipeApi;
|
||||
public cookbooks: PublicCookbooksApi;
|
||||
public foods: PublicFoodsApi;
|
||||
public categories: PublicCategoriesApi;
|
||||
public tags: PublicTagsApi;
|
||||
public tools: PublicToolsApi;
|
||||
public households: PublicHouseholdApi
|
||||
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(requests);
|
||||
this.recipes = new PublicRecipeApi(requests, groupSlug);
|
||||
this.cookbooks = new PublicCookbooksApi(requests, groupSlug);
|
||||
this.foods = new PublicFoodsApi(requests, groupSlug);
|
||||
this.categories = new PublicCategoriesApi(requests, groupSlug);
|
||||
this.tags = new PublicTagsApi(requests, groupSlug);
|
||||
this.tools = new PublicToolsApi(requests, groupSlug);
|
||||
this.households = new PublicHouseholdApi(requests, groupSlug);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
|
||||
import { ReadCookBook } from "~/lib/api/types/cookbook";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
|
||||
const prefix = "/api";
|
||||
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
|
||||
|
||||
const routes = {
|
||||
cookbooksGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/cookbooks`,
|
||||
cookbooksGroupSlugCookbookId: (groupSlug: string | number, cookbookId: string | number) => `${exploreGroupSlug(groupSlug)}/cookbooks/${cookbookId}`,
|
||||
};
|
||||
|
||||
export class PublicCookbooksApi extends BaseCRUDAPIReadOnly<ReadCookBook> {
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.cookbooksGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.cookbooksGroupSlugCookbookId(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
|
||||
import { IngredientFood } from "~/lib/api/types/recipe";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
|
||||
const prefix = "/api";
|
||||
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
|
||||
|
||||
const routes = {
|
||||
foodsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/foods`,
|
||||
foodsGroupSlugFoodId: (groupSlug: string | number, foodId: string | number) => `${exploreGroupSlug(groupSlug)}/foods/${foodId}`,
|
||||
};
|
||||
|
||||
export class PublicFoodsApi extends BaseCRUDAPIReadOnly<IngredientFood> {
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.foodsGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.foodsGroupSlugFoodId(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
|
||||
import { HouseholdSummary } from "~/lib/api/types/household";
|
||||
import { ApiRequestInstance, PaginationData } from "~/lib/api/types/non-generated";
|
||||
|
||||
const prefix = "/api";
|
||||
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
|
||||
|
||||
const routes = {
|
||||
householdsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/households`,
|
||||
householdsGroupSlugHouseholdSlug: (groupSlug: string | number, householdSlug: string | number) => `${exploreGroupSlug(groupSlug)}/households/${householdSlug}`,
|
||||
};
|
||||
|
||||
export class PublicHouseholdApi extends BaseCRUDAPIReadOnly<HouseholdSummary> {
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.householdsGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.householdsGroupSlugHouseholdSlug(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
|
||||
import { RecipeCategory, RecipeTag, RecipeTool } from "~/lib/api/types/recipe";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
|
||||
const prefix = "/api";
|
||||
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
|
||||
|
||||
const routes = {
|
||||
categoriesGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/categories`,
|
||||
categoriesGroupSlugCategoryId: (groupSlug: string | number, categoryId: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/categories/${categoryId}`,
|
||||
tagsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tags`,
|
||||
tagsGroupSlugTagId: (groupSlug: string | number, tagId: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tags/${tagId}`,
|
||||
toolsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tools`,
|
||||
toolsGroupSlugToolId: (groupSlug: string | number, toolId: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tools`,
|
||||
};
|
||||
|
||||
export class PublicCategoriesApi extends BaseCRUDAPIReadOnly<RecipeCategory> {
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.categoriesGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.categoriesGroupSlugCategoryId(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class PublicTagsApi extends BaseCRUDAPIReadOnly<RecipeTag> {
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.tagsGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.tagsGroupSlugTagId(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class PublicToolsApi extends BaseCRUDAPIReadOnly<RecipeTool> {
|
||||
constructor(requests: ApiRequestInstance, groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.toolsGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.toolsGroupSlugToolId(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
|
||||
import { route } from "../../base";
|
||||
import { Recipe, RecipeSuggestionQuery, RecipeSuggestionResponse } from "~/lib/api/types/recipe";
|
||||
import { ApiRequestInstance, PaginationData } from "~/lib/api/types/non-generated";
|
||||
import { RecipeSearchQuery } from "../../user/recipes/recipe";
|
||||
|
||||
const prefix = "/api";
|
||||
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
|
||||
|
||||
const routes = {
|
||||
recipesGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/recipes`,
|
||||
recipesGroupSlugRecipeSlug: (groupSlug: string | number, recipeSlug: string | number) => `${exploreGroupSlug(groupSlug)}/recipes/${recipeSlug}`,
|
||||
};
|
||||
|
||||
export class PublicRecipeApi extends BaseCRUDAPIReadOnly<Recipe> {
|
||||
constructor(requests: ApiRequestInstance, private readonly groupSlug: string) {
|
||||
super(
|
||||
requests,
|
||||
routes.recipesGroupSlug(groupSlug),
|
||||
(itemId: string | number) => routes.recipesGroupSlugRecipeSlug(groupSlug, itemId)
|
||||
);
|
||||
}
|
||||
|
||||
async search(rsq: RecipeSearchQuery) {
|
||||
return await this.requests.get<PaginationData<Recipe>>(route(routes.recipesGroupSlug(this.groupSlug), rsq));
|
||||
}
|
||||
|
||||
async getSuggestions(q: RecipeSuggestionQuery, foods: string[] | null = null, tools: string[]| null = null) {
|
||||
return await this.requests.get<RecipeSuggestionResponse>(
|
||||
route(`${routes.recipesGroupSlug(this.groupSlug)}/suggestions`, { ...q, foods, tools })
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { BaseAPI } from "../base/base-clients";
|
||||
import { Recipe } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
recipeShareToken: (token: string) => `${prefix}/recipes/shared/${token}`,
|
||||
};
|
||||
|
||||
export class SharedApi extends BaseAPI {
|
||||
async getShared(item_id: string) {
|
||||
return await this.requests.get<Recipe>(routes.recipeShareToken(item_id));
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
import { BaseAPI } from "../base/base-clients";
|
||||
import { ValidationResponse } from "~/lib/api/types/response";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
group: (name: string) => `${prefix}/validators/group?name=${name}`,
|
||||
user: (name: string) => `${prefix}/validators/user/name?name=${name}`,
|
||||
email: (name: string) => `${prefix}/validators/user/email?email=${name}`,
|
||||
recipe: (groupId: string, name: string) => `${prefix}/validators/group/recipe?group_id=${groupId}?name=${name}`,
|
||||
};
|
||||
|
||||
export class ValidatorsApi extends BaseAPI {
|
||||
async group(name: string) {
|
||||
return await this.requests.get<ValidationResponse>(routes.group(name));
|
||||
}
|
||||
|
||||
async username(name: string) {
|
||||
return await this.requests.get<ValidationResponse>(routes.user(name));
|
||||
}
|
||||
|
||||
async email(email: string) {
|
||||
return await this.requests.get<ValidationResponse>(routes.email(email));
|
||||
}
|
||||
|
||||
async recipe(groupId: string, name: string) {
|
||||
return await this.requests.get<ValidationResponse>(routes.recipe(groupId, name));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user