diff --git a/API-Project/src/gateways/ingredients.gateway.ts b/API-Project/src/gateways/ingredients.gateway.ts index 76c6ba6..cd476cf 100644 --- a/API-Project/src/gateways/ingredients.gateway.ts +++ b/API-Project/src/gateways/ingredients.gateway.ts @@ -74,7 +74,7 @@ export class IngredientsGateway { const client = await this.connection.getPoolClient() const query = { - text: 'SELECT * FROM Ingredients i WHERE LOWER(SUBSTRING(i.name, 1, 1)) = $1', + text: 'SELECT * FROM Ingredients i WHERE LOWER(SUBSTRING(i.name, 1, 1)) = $1 ORDER BY i.name', values: [letter.toLowerCase()], }; @@ -100,7 +100,7 @@ export class IngredientsGateway { const client = await this.connection.getPoolClient() const query = { - text: 'SELECT * FROM Ingredients WHERE LOWER(name) LIKE $1', + text: 'SELECT * FROM Ingredients WHERE LOWER(name) LIKE $1 ORDER BY name', values: [`%${prompt.toLowerCase()}%`], }; diff --git a/API-Project/src/gateways/recipe.gateway.ts b/API-Project/src/gateways/recipe.gateway.ts index 779f22f..68e7a08 100644 --- a/API-Project/src/gateways/recipe.gateway.ts +++ b/API-Project/src/gateways/recipe.gateway.ts @@ -29,7 +29,7 @@ export class RecipeGateway { recipes.push(recipe); } - return recipes + return recipes as Recipe[]; } async getById(id: number) : Promise{ @@ -86,6 +86,6 @@ export class RecipeGateway { } } - return recipes + return recipes as Recipe[]; } } \ No newline at end of file