Implement recipe retrieval methods and enhance inventory item types for better data handling
This commit is contained in:
@@ -270,4 +270,35 @@ export class RecipesService {
|
||||
summary,
|
||||
};
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
return this.prisma.recipe.findMany({
|
||||
include: {
|
||||
ingredients: {
|
||||
include: {
|
||||
product: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async findOne(id: number) {
|
||||
const recipe = await this.prisma.recipe.findUnique({
|
||||
where: { id },
|
||||
include: {
|
||||
ingredients: {
|
||||
include: {
|
||||
product: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!recipe) {
|
||||
throw new NotFoundException(`Recipe with id ${id} not found`);
|
||||
}
|
||||
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user