mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-05 11:06:28 +00:00
update
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const knex = require('../../../infrastructure/database/knex');
|
||||
const winston = require('../../helpers/winston.logger');
|
||||
|
||||
// CHECK CARD NUMBER
|
||||
const checkCardNumber = (cardNumber) => {
|
||||
@@ -624,7 +625,7 @@ const updateReservationAndLoadingBalance = async (
|
||||
.then(() => {
|
||||
// insert load balance history
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} result insert t_d_load_balance_history updateReservationAndLoadingBalance success`
|
||||
`${reservationNumber} result insert t_d_load_balance_history updateReservationAndLoadingBalance success`
|
||||
);
|
||||
return knex('trx.t_d_load_balance_history')
|
||||
.transacting(trx)
|
||||
@@ -652,7 +653,7 @@ const updateReservationAndLoadingBalance = async (
|
||||
});
|
||||
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} result insert t_d_load_balance_history_detail updateReservationAndLoadingBalance success`
|
||||
`${reservationNumber} result insert t_d_load_balance_history_detail updateReservationAndLoadingBalance success`
|
||||
);
|
||||
// insert detail load balance
|
||||
return knex('trx.t_d_load_balance_history_detail')
|
||||
@@ -662,7 +663,7 @@ const updateReservationAndLoadingBalance = async (
|
||||
.then(() => {
|
||||
// update reservation
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} result insert t_d_reservation_balance updateReservationAndLoadingBalance success`
|
||||
`${reservationNumber} result insert t_d_reservation_balance updateReservationAndLoadingBalance success`
|
||||
);
|
||||
return knex('trx.t_d_reservation_balance')
|
||||
.transacting(trx)
|
||||
@@ -682,13 +683,13 @@ const updateReservationAndLoadingBalance = async (
|
||||
})
|
||||
.then(() => {
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} commit update t_d_reservation_balance updateReservationAndLoadingBalance`
|
||||
`${reservationNumber} commit update t_d_reservation_balance updateReservationAndLoadingBalance`
|
||||
);
|
||||
trx.commit();
|
||||
})
|
||||
.catch((error) => {
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} rollback update t_d_reservation_balance updateReservationAndLoadingBalance: ${error.message}`
|
||||
`${reservationNumber} rollback update t_d_reservation_balance updateReservationAndLoadingBalance: ${error.message}`
|
||||
);
|
||||
trx.rollback(); // Rollback transaction
|
||||
throw error; // Rethrow error to outer catch
|
||||
@@ -696,14 +697,14 @@ const updateReservationAndLoadingBalance = async (
|
||||
})
|
||||
.then((result) => {
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} result updateReservationAndLoadingBalance success`
|
||||
`${reservationNumber} result updateReservationAndLoadingBalance success`
|
||||
);
|
||||
// console.log(result);
|
||||
return result.rowCount;
|
||||
})
|
||||
.catch((error) => {
|
||||
winston.logger.debug(
|
||||
`${uniqueCode} result updateReservationAndLoadingBalance error: ${error.message}`
|
||||
`${reservationNumber} result updateReservationAndLoadingBalance error: ${error.message}`
|
||||
);
|
||||
// console.log(error.message);
|
||||
return error.message;
|
||||
|
||||
Reference in New Issue
Block a user