mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 05:25:26 +02:00
feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
89ab7fac25
commit
c24d532608
403 changed files with 23959 additions and 19557 deletions
|
@ -1,5 +1,5 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { AllBackups, BackupOptions, CreateBackup } from "~/lib/api/types/admin";
|
||||
import type { AllBackups, BackupOptions, CreateBackup } from "~/lib/api/types/admin";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { EmailInitationResponse, EmailInvitation } from "~/lib/api/types/household";
|
||||
import { ForgotPassword } from "~/lib/api/types/user";
|
||||
import { EmailTest } from "~/lib/api/types/admin";
|
||||
import type { EmailInitationResponse, EmailInvitation } from "~/lib/api/types/household";
|
||||
import type { ForgotPassword } from "~/lib/api/types/user";
|
||||
import type { EmailTest } from "~/lib/api/types/admin";
|
||||
|
||||
const routes = {
|
||||
base: "/api/admin/email",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { CreateCookBook, RecipeCookBook, UpdateCookBook } from "~/lib/api/types/cookbook";
|
||||
import type { CreateCookBook, RecipeCookBook, UpdateCookBook } from "~/lib/api/types/cookbook";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { GroupEventNotifierCreate, GroupEventNotifierOut, GroupEventNotifierUpdate } from "~/lib/api/types/household";
|
||||
import type { GroupEventNotifierCreate, GroupEventNotifierOut, GroupEventNotifierUpdate } from "~/lib/api/types/household";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { PlanRulesCreate, PlanRulesOut } from "~/lib/api/types/meal-plan";
|
||||
import type { PlanRulesCreate, PlanRulesOut } from "~/lib/api/types/meal-plan";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { CreatePlanEntry, CreateRandomEntry, ReadPlanEntry, UpdatePlanEntry } from "~/lib/api/types/meal-plan";
|
||||
import type { CreatePlanEntry, CreateRandomEntry, ReadPlanEntry, UpdatePlanEntry } from "~/lib/api/types/meal-plan";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { ReportSummary } from "~/lib/api/types/reports";
|
||||
import { SupportedMigrations } from "~/lib/api/types/group";
|
||||
import type { ReportSummary } from "~/lib/api/types/reports";
|
||||
import type { SupportedMigrations } from "~/lib/api/types/group";
|
||||
|
||||
const prefix = "/api";
|
||||
export interface MigrationPayload {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { MultiPurposeLabelCreate, MultiPurposeLabelOut, MultiPurposeLabelUpdate } from "~/lib/api/types/labels";
|
||||
import type { MultiPurposeLabelCreate, MultiPurposeLabelOut, MultiPurposeLabelUpdate } from "~/lib/api/types/labels";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { CreateGroupRecipeAction, GroupRecipeActionOut } from "~/lib/api/types/household";
|
||||
import type { CreateGroupRecipeAction, GroupRecipeActionOut } from "~/lib/api/types/household";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
groupRecipeActions: `${prefix}/households/recipe-actions`,
|
||||
groupRecipeActionsId: (id: string | number) => `${prefix}/households/recipe-actions/${id}`,
|
||||
groupRecipeActionsIdTriggerRecipeSlug: (id: string | number, recipeSlug: string) => `${prefix}/households/recipe-actions/${id}/trigger/${recipeSlug}`,
|
||||
};
|
||||
groupRecipeActions: `${prefix}/households/recipe-actions`,
|
||||
groupRecipeActionsId: (id: string | number) => `${prefix}/households/recipe-actions/${id}`,
|
||||
groupRecipeActionsIdTriggerRecipeSlug: (id: string | number, recipeSlug: string) => `${prefix}/households/recipe-actions/${id}/trigger/${recipeSlug}`,
|
||||
};
|
||||
|
||||
export class GroupRecipeActionsAPI extends BaseCRUDAPI<CreateGroupRecipeAction, GroupRecipeActionOut> {
|
||||
baseRoute = routes.groupRecipeActions;
|
||||
itemRoute = routes.groupRecipeActionsId;
|
||||
export class GroupRecipeActionsAPI extends BaseCRUDAPI<CreateGroupRecipeAction, GroupRecipeActionOut> {
|
||||
baseRoute = routes.groupRecipeActions;
|
||||
itemRoute = routes.groupRecipeActionsId;
|
||||
|
||||
async triggerAction(id: string | number, recipeSlug: string, scaledAmount: number) {
|
||||
return await this.requests.post(routes.groupRecipeActionsIdTriggerRecipeSlug(id, recipeSlug), {scaledAmount});
|
||||
}
|
||||
async triggerAction(id: string | number, recipeSlug: string, scaledAmount: number) {
|
||||
return await this.requests.post(routes.groupRecipeActionsIdTriggerRecipeSlug(id, recipeSlug), { scaledAmount });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { ReportCategory, ReportOut, ReportSummary } from "~/lib/api/types/reports";
|
||||
import type { ReportCategory, ReportOut, ReportSummary } from "~/lib/api/types/reports";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { SuccessResponse } from "~/lib/api/types/response";
|
||||
import { SeederConfig } from "~/lib/api/types/group";
|
||||
import type { SuccessResponse } from "~/lib/api/types/response";
|
||||
import type { SeederConfig } from "~/lib/api/types/group";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
import {
|
||||
import type { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
||||
import type {
|
||||
ShoppingListAddRecipeParamsBulk,
|
||||
ShoppingListCreate,
|
||||
ShoppingListItemCreate,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { CreateWebhook, ReadWebhook } from "~/lib/api/types/household";
|
||||
import type { CreateWebhook, ReadWebhook } from "~/lib/api/types/household";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { PaginationData } from "../types/non-generated";
|
||||
import { QueryValue } from "../base/route";
|
||||
import { GroupBase, GroupInDB, GroupSummary, UserSummary } from "~/lib/api/types/user";
|
||||
import {
|
||||
import type { PaginationData } from "../types/non-generated";
|
||||
import type { QueryValue } from "../base/route";
|
||||
import type { GroupBase, GroupInDB, GroupSummary, UserSummary } from "~/lib/api/types/user";
|
||||
import type {
|
||||
GroupAdminUpdate,
|
||||
GroupStorage,
|
||||
ReadGroupPreferences,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { BaseCRUDAPIReadOnly } from "../base/base-clients";
|
||||
import { PaginationData } from "../types/non-generated";
|
||||
import { QueryValue } from "../base/route";
|
||||
import { UserOut } from "~/lib/api/types/user";
|
||||
import {
|
||||
import type { PaginationData } from "../types/non-generated";
|
||||
import type { QueryValue } from "../base/route";
|
||||
import type { UserOut } from "~/lib/api/types/user";
|
||||
import type {
|
||||
HouseholdInDB,
|
||||
HouseholdStatistics,
|
||||
ReadHouseholdPreferences,
|
||||
|
@ -27,7 +27,7 @@ const routes = {
|
|||
invitation: `${prefix}/households/invitations`,
|
||||
|
||||
householdsId: (id: string | number) => `${prefix}/groups/households/${id}`,
|
||||
householdsSelfRecipesSlug: (recipeSlug: string) => `${prefix}/households/self/recipes/${recipeSlug}`,
|
||||
householdsSelfRecipesSlug: (recipeSlug: string) => `${prefix}/households/self/recipes/${recipeSlug}`,
|
||||
};
|
||||
|
||||
export class HouseholdAPI extends BaseCRUDAPIReadOnly<HouseholdSummary> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { config } from "../config";
|
||||
import { CategoryIn, RecipeCategoryResponse } from "~/lib/api/types/recipe";
|
||||
import type { CategoryIn, RecipeCategoryResponse } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = config.PREFIX + "/organizers";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { config } from "../config";
|
||||
import { RecipeTagResponse, TagIn } from "~/lib/api/types/recipe";
|
||||
import type { RecipeTagResponse, TagIn } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = config.PREFIX + "/organizers";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { config } from "../config";
|
||||
import { RecipeTool, RecipeToolCreate, RecipeToolResponse } from "~/lib/api/types/recipe";
|
||||
import type { RecipeTool, RecipeToolCreate, RecipeToolResponse } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = config.PREFIX + "/organizers";
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { AssignCategories, AssignSettings, AssignTags, DeleteRecipes, ExportRecipes } from "~/lib/api/types/recipe";
|
||||
import { GroupDataExport } from "~/lib/api/types/group";
|
||||
import type { AssignCategories, AssignSettings, AssignTags, DeleteRecipes, ExportRecipes } from "~/lib/api/types/recipe";
|
||||
import type { GroupDataExport } from "~/lib/api/types/group";
|
||||
|
||||
// Many bulk actions return nothing
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface BulkActionResponse {}
|
||||
|
||||
type BulkActionResponse = object;
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { CreateIngredientFood, IngredientFood } from "~/lib/api/types/recipe";
|
||||
import type { CreateIngredientFood, IngredientFood } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
@ -14,7 +14,6 @@ export class FoodAPI extends BaseCRUDAPI<CreateIngredientFood, IngredientFood> {
|
|||
itemRoute = routes.foodsFood;
|
||||
|
||||
merge(fromId: string, toId: string) {
|
||||
// @ts-ignore TODO: fix this
|
||||
return this.requests.put<IngredientFood>(routes.merge, { fromFood: fromId, toFood: toId });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import { CreateIngredientUnit, IngredientUnit } from "~/lib/api/types/recipe";
|
||||
import type { CreateIngredientUnit, IngredientUnit } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
@ -14,7 +14,6 @@ export class UnitAPI extends BaseCRUDAPI<CreateIngredientUnit, IngredientUnit> {
|
|||
itemRoute = routes.unitsUnit;
|
||||
|
||||
merge(fromId: string, toId: string) {
|
||||
// @ts-ignore TODO: fix this
|
||||
return this.requests.put<IngredientUnit>(routes.merge, { fromUnit: fromId, toUnit: toId });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../../base/base-clients";
|
||||
import { RecipeCommentCreate, RecipeCommentOut, RecipeCommentUpdate } from "~/lib/api/types/recipe";
|
||||
import type { RecipeCommentCreate, RecipeCommentOut, RecipeCommentUpdate } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../../base/base-clients";
|
||||
import { RecipeShareToken, RecipeShareTokenCreate } from "~/lib/api/types/recipe";
|
||||
import type { RecipeShareToken, RecipeShareTokenCreate } from "~/lib/api/types/recipe";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { BaseCRUDAPI } from "../../base/base-clients";
|
|||
import { route } from "../../base";
|
||||
import { CommentsApi } from "./recipe-comments";
|
||||
import { RecipeShareApi } from "./recipe-share";
|
||||
import {
|
||||
import type {
|
||||
Recipe,
|
||||
CreateRecipe,
|
||||
RecipeAsset,
|
||||
|
@ -17,7 +17,7 @@ import {
|
|||
RecipeTimelineEventOut,
|
||||
RecipeTimelineEventUpdate,
|
||||
} from "~/lib/api/types/recipe";
|
||||
import { ApiRequestInstance, PaginationData } from "~/lib/api/types/non-generated";
|
||||
import type { ApiRequestInstance, PaginationData } from "~/lib/api/types/non-generated";
|
||||
|
||||
export type Parser = "nlp" | "brute" | "openai";
|
||||
|
||||
|
@ -113,9 +113,9 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
|||
});
|
||||
}
|
||||
|
||||
async getSuggestions(q: RecipeSuggestionQuery, foods: string[] | null = null, tools: string[]| null = null) {
|
||||
async getSuggestions(q: RecipeSuggestionQuery, foods: string[] | null = null, tools: string[] | null = null) {
|
||||
return await this.requests.get<RecipeSuggestionResponse>(
|
||||
route(routes.recipesSuggestions, { ...q, foods, tools })
|
||||
route(routes.recipesSuggestions, { ...q, foods, tools }),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,9 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
|||
formData.append("images", fileObject);
|
||||
formData.append("extension", fileName.split(".").pop() ?? "");
|
||||
|
||||
let apiRoute = routes.recipesCreateFromImage
|
||||
let apiRoute = routes.recipesCreateFromImage;
|
||||
if (translateLanguage) {
|
||||
apiRoute = `${apiRoute}?translateLanguage=${translateLanguage}`
|
||||
apiRoute = `${apiRoute}?translateLanguage=${translateLanguage}`;
|
||||
}
|
||||
|
||||
return await this.requests.post<string>(apiRoute, formData);
|
||||
|
@ -197,7 +197,7 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
|||
}
|
||||
|
||||
async updateLastMade(recipeSlug: string, timestamp: string) {
|
||||
return await this.requests.patch<Recipe, RecipeLastMade>(routes.recipesSlugLastMade(recipeSlug), { timestamp })
|
||||
return await this.requests.patch<Recipe, RecipeLastMade>(routes.recipesSlugLastMade(recipeSlug), { timestamp });
|
||||
}
|
||||
|
||||
async createTimelineEvent(payload: RecipeTimelineEventIn) {
|
||||
|
@ -207,7 +207,7 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
|||
async updateTimelineEvent(eventId: string, payload: RecipeTimelineEventUpdate) {
|
||||
return await this.requests.put<RecipeTimelineEventOut, RecipeTimelineEventUpdate>(
|
||||
routes.recipesTimelineEventId(eventId),
|
||||
payload
|
||||
payload,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
|||
routes.recipesTimelineEvent,
|
||||
{
|
||||
params: { page, perPage, ...params },
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ import { BaseAPI } from "../base/base-clients";
|
|||
|
||||
export class UploadFile extends BaseAPI {
|
||||
file(url: string, fileObject: any) {
|
||||
return this.requests.post<string>(url, fileObject);
|
||||
const { $axios } = useNuxtApp();
|
||||
return $axios.post<string>(url, fileObject, { headers: { "Content-Type": "multipart/form-data" } });
|
||||
// return this.requests.post<string>(url, fileObject);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { CreateUserRegistration } from "~/lib/api/types/user";
|
||||
import type { CreateUserRegistration } from "~/lib/api/types/user";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "../base/base-clients";
|
||||
import {
|
||||
import type {
|
||||
ChangePassword,
|
||||
DeleteTokenResponse,
|
||||
LongLiveTokenIn,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { FileTokenResponse } from "~/lib/api/types/response";
|
||||
import type { FileTokenResponse } from "~/lib/api/types/response";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue