From 10e38babcdedd7fe303eb33c373feee2e6ab7e8c Mon Sep 17 00:00:00 2001 From: Mohamad Ihsan Date: Tue, 21 Feb 2023 19:54:06 +0700 Subject: [PATCH] update --- .../loadbalance/loadbalance.controller.js | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/application/modules/loadbalance/loadbalance.controller.js b/application/modules/loadbalance/loadbalance.controller.js index 99e43a6..3da3f9c 100644 --- a/application/modules/loadbalance/loadbalance.controller.js +++ b/application/modules/loadbalance/loadbalance.controller.js @@ -1368,10 +1368,6 @@ const loadingBalanceInsert = async (param) => { flag ); - if (insertLoadingBalance > 0) { - console.log('11111111111111111111111111111111111'); - } - // log warn winston.logger.warn( `${uniqueCode} AAAAAAAAAAAAAAAAAA [DATA] : ${JSON.stringify( @@ -1387,27 +1383,35 @@ const loadingBalanceInsert = async (param) => { )} [FLAG] : ${JSON.stringify(flag)}` ); - // log warn - winston.logger.warn( - `${uniqueCode} BBBBBBBBBBBBBBBBBBBBBB ${JSON.stringify( - insertLoadingBalance - )}` - ); + if (insertLoadingBalance > 0) { + result = { + code: '00', + message: write_status + ? 'transaction saved successfully. Err: failed write to the card' + : 'balance loaded successfully', + data: { + load_balance_number: loadBalanceNumber, + }, + }; - result = { - code: '99', - message: write_status - ? 'transaction saved successfully. Err: failed write to the card' - : 'balance loaded successfully', - data: { - load_balance_number: loadBalanceNumber, - }, - }; + // log info + winston.logger.info( + `${uniqueCode} RESPONSE load balance insert: ${JSON.stringify(result)}` + ); + } else { + result = { + code: '423', + message: 'insert failed', + data: { + load_balance_number: loadBalanceNumber, + }, + }; - // log info - winston.logger.info( - `${uniqueCode} RESPONSE load balance insert: ${JSON.stringify(result)}` - ); + // log warn + winston.logger.warn( + `${uniqueCode} RESPONSE load balance insert: ${JSON.stringify(result)}` + ); + } return result; } catch (error) {