* Extended functionalities

* Added different UIs
This commit is contained in:
2026-06-24 21:43:40 +02:00
parent 282f4864c4
commit f15bb7a916
348 changed files with 59057 additions and 498 deletions

View File

@@ -16,7 +16,7 @@ public class RecipeService : IRecipeService
public RecipeService(AppDbContext db) => _db = db;
public async Task<IReadOnlyList<RecipeListItemDto>> GetRecipesAsync(
int? category, string? search, CancellationToken ct = default)
int? category, string? search, string? ingredient, CancellationToken ct = default)
{
var query = _db.Recipes.AsNoTracking().Where(r => r.IsActive);
@@ -31,6 +31,13 @@ public class RecipeService : IRecipeService
query = query.Where(r => EF.Functions.ILike(r.Name, $"%{term}%"));
}
if (!string.IsNullOrWhiteSpace(ingredient))
{
var ingredientTerm = ingredient.Trim();
query = query.Where(r =>
r.Ingredients.Any(i => EF.Functions.ILike(i.Name, $"%{ingredientTerm}%")));
}
return await query
.OrderBy(r => r.Name)
.Select(r => new RecipeListItemDto
@@ -69,6 +76,7 @@ public class RecipeService : IRecipeService
AmountGrams = i.AmountGrams,
Unit = i.Unit,
SortOrder = i.SortOrder,
CatalogItemId = i.CatalogItemId,
})
.ToList(),
Steps = r.Steps