From b8163a00fbac46659bee9f24bd039dfc5bb16973 Mon Sep 17 00:00:00 2001 From: lahirulakruwan Date: Thu, 24 Oct 2024 15:20:29 +0530 Subject: [PATCH] Monthly leave dates table no records found error issue fixed --- api/main.bal | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/api/main.bal b/api/main.bal index c5a2d7c..5b3f9c7 100644 --- a/api/main.bal +++ b/api/main.bal @@ -6054,12 +6054,23 @@ AND p.organization_id IN ( if (monthly_leave_dates_raw is MonthlyLeaveDates) { return new (0,monthly_leave_dates_raw); + }else{ + // Return a new empty MonthlyLeaveDates object if no record is found + MonthlyLeaveDates emptyLeaveDates = { + id: null, + year: null, + month: null, + organization_id: null, + leave_dates_list: [], + daily_amount: null, + created: null, + updated: null, + total_days_in_month: null, + leave_dates: null + }; + return new(0,emptyLeaveDates); } - } - - return error("Provide not null value for organization_id and year and month."); - } }