Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function upsertFood(newFood: NewFood): Promise<Food> {
async function fetchFoodsByName(
name: Required<Food>['name'],
params: FoodSearchParams = {},
) {
): Promise<readonly Food[]> {
Comment on lines 133 to +136
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetchFoodsByName function lacks JSDoc documentation, creating inconsistency with other repository helper functions like fetchFoodById, fetchFoodByEan, and fetchFoodsByIds which all have comprehensive JSDoc. Consider adding documentation following the same pattern:

/**
 * Fetches Foods by name using enhanced search with scoring.
 * Supports both regular search and favorites-only search.
 * @param name - The food name to search for
 * @param params - Optional search parameters (userId, isFavoritesSearch, limit)
 * @returns Array of matching Foods
 * @throws Error on API/validation error
 */
async function fetchFoodsByName(
  name: Required<Food>['name'],
  params: FoodSearchParams = {},
): Promise<readonly Food[]> {

Copilot uses AI. Check for mistakes.
const { userId, isFavoritesSearch, limit = 50 } = params

try {
Expand Down Expand Up @@ -172,7 +172,9 @@ async function fetchFoodsByName(
}
}

Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetchFoods function lacks JSDoc documentation, creating inconsistency with other repository helper functions. Consider adding documentation following the pattern used elsewhere in this file:

/**
 * Fetches all Foods with optional filtering.
 * @param params - Optional search parameters (limit, allowedFoods, etc.)
 * @returns Array of Foods
 * @throws Error on API/validation error
 */
async function fetchFoods(
  params: FoodSearchParams = {},
): Promise<readonly Food[]> {
Suggested change
/**
* Fetches all Foods with optional filtering.
* @param params - Optional search parameters (limit, allowedFoods, etc.)
* @returns Array of Foods
* @throws Error on API/validation error
*/

Copilot uses AI. Check for mistakes.
async function fetchFoods(params: FoodSearchParams = {}) {
async function fetchFoods(
params: FoodSearchParams = {},
): Promise<readonly Food[]> {
return await internalCachedSearchFoods({ field: '', value: '' }, params)
}

Expand Down