From 872a5e6237d7b191f59ddefc53aa43647660bc51 Mon Sep 17 00:00:00 2001 From: nfesta2023 <142601504+nfesta2023@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:28:39 +0700 Subject: [PATCH] return [] instead of raising error (#106) Co-authored-by: NHT --- src/feature/food/food.service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/feature/food/food.service.ts b/src/feature/food/food.service.ts index 4f7ba78..6451afa 100644 --- a/src/feature/food/food.service.ts +++ b/src/feature/food/food.service.ts @@ -617,8 +617,11 @@ export class FoodService { // Check if there is no sidedish for this main dish if (sideDishesIds.length === 0) { - res.statusCode = 404; - res.message = 'No side dishes found'; + // res.statusCode = 404; + // res.message = 'No side dishes found'; + res.statusCode = 200; + res.message = 'Get side dishes successfully'; + res.data = []; return res; } @@ -834,7 +837,8 @@ export class FoodService { // Check if there is no side dish for this main dish if (menuItemIds.length === 0) { - throw new HttpException('No food found', HttpStatus.NOT_FOUND); + // throw new HttpException('No food found', HttpStatus.NOT_FOUND); + return []; } //Get main dish schedule