Files
recipe-app/backend/dist/recipes/recipes.controller.d.ts
T
Nils-Johan Gynther 969dafdbc6
Test Suite / test (24.15.0) (push) Has been cancelled
Refactor code structure for improved readability and maintainability
2026-05-06 07:37:59 +02:00

647 lines
21 KiB
TypeScript

import { RecipesService } from './recipes.service';
import { CreateRecipeDto } from './dto/create-recipe.dto';
import { CreateIngredientDto } from './dto/create-ingredient.dto';
import { ParseMarkdownDto } from './dto/parse-markdown.dto';
import { ShareRecipeDto } from './dto/share-recipe.dto';
import { SetRecipeVisibilityDto } from './dto/set-recipe-visibility.dto';
declare class UpdateImageDto {
sourceUrl: string;
}
export declare class RecipesController {
private readonly recipesService;
constructor(recipesService: RecipesService);
parseMarkdown(dto: ParseMarkdownDto): Promise<{
name: string;
description: string;
instructions: string;
ingredients: {
rawName: string;
rawLine: string;
alternatives: string[];
quantity: number;
unit: string;
note: string | null;
suggestions: {
productId: number;
productName: string;
score: number;
}[];
}[];
}>;
getAiSuggestions(user: {
userId: number;
}): Promise<{
suggestions: import("./recipes.service").AiRecipeSuggestion[];
}>;
findAll(user: {
userId: number;
}): Promise<({
owner: {
id: number;
username: string;
} | null;
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
shares: {
userId: number;
}[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
})[]>;
getInventoryPreview(id: number, user: {
userId: number;
}): Promise<{
recipe: {
id: number;
name: string;
description: string | null;
};
ingredients: {
ingredientId: any;
productId: any;
productName: any;
requiredQuantity: number;
requiredUnit: any;
note: any;
availableQuantity: number;
availableUnit: any;
matchingInventoryItems: {
id: any;
quantity: any;
unit: any;
location: any;
brand: any;
bestBeforeDate: any;
}[];
otherInventoryItems: {
id: any;
quantity: any;
unit: any;
location: any;
convertedQuantity: number;
canConvert: boolean;
}[];
status: "missing" | "enough" | "unit_mismatch";
fromPantry: boolean;
missingQuantity: number;
}[];
summary: {
totalIngredients: number;
enoughCount: number;
missingCount: number;
unitMismatchCount: number;
canCookExactly: boolean;
pantryCount: number;
};
}>;
findOne(id: number, user: {
userId: number;
}): Promise<{
owner: {
id: number;
username: string;
} | null;
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
shares: {
userId: number;
}[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
create(createRecipeDto: CreateRecipeDto, user: {
userId: number;
}): Promise<{
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
update(id: number, createRecipeDto: CreateRecipeDto, user: {
userId: number;
}): Promise<{
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
remove(id: number, user: {
userId: number;
}): Promise<void>;
updateImage(id: number, dto: UpdateImageDto, user: {
userId: number;
}): Promise<{
owner: {
id: number;
username: string;
} | null;
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
shares: {
userId: number;
}[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
addIngredient(id: number, ingredient: CreateIngredientDto, user: {
userId: number;
}): Promise<{
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
}>;
setVisibility(id: number, dto: SetRecipeVisibilityDto, user: {
userId: number;
}): Promise<{
owner: {
id: number;
username: string;
} | null;
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
shares: {
userId: number;
}[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
shareRecipe(id: number, dto: ShareRecipeDto, user: {
userId: number;
}): Promise<{
owner: {
id: number;
username: string;
} | null;
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
shares: {
userId: number;
}[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
unshareRecipe(id: number, username: string, user: {
userId: number;
}): Promise<{
owner: {
id: number;
username: string;
} | null;
ingredients: ({
product: ({
nutrition: {
calories: number | null;
protein: number | null;
fat: number | null;
carbohydrates: number | null;
salt: number | null;
sugar: number | null;
fiber: number | null;
id: number;
productId: number;
} | null;
} & {
category: string | null;
status: string;
name: string;
categoryId: number | null;
canonicalName: string | null;
id: number;
normalizedName: string;
isActive: boolean;
deletedAt: Date | null;
createdAt: Date;
updatedAt: Date;
ownerId: number;
isPrivate: boolean;
}) | null;
} & {
id: number;
createdAt: Date;
updatedAt: Date;
productId: number | null;
quantity: import("@prisma/client/runtime/library").Decimal | null;
unit: string | null;
rawName: string;
rawLine: string | null;
note: string | null;
matchConfidence: number | null;
matchSource: string | null;
alternativeProductIds: import("@prisma/client/runtime/library").JsonValue | null;
recipeId: number;
analysisStatus: string | null;
})[];
shares: {
userId: number;
}[];
} & {
isPublic: boolean;
name: string;
id: number;
createdAt: Date;
updatedAt: Date;
ownerId: number | null;
description: string | null;
instructions: string | null;
imageUrl: string | null;
servings: number | null;
}>;
}
export {};