Refactor backend services and preserve transaction contracts

This commit is contained in:
Mohamad Ihsan
2026-11-24 18:26:33 +07:00
parent cb05cb15d6
commit f7c9c186f3
40 changed files with 1144 additions and 1786 deletions
@@ -1,51 +1,11 @@
const { param, body, validationResult } = require('express-validator');
const { validationResult } = require('express-validator');
const validate = require('./loadbalance.validation');
const helper = require('../../helpers/helper');
const winston = require('../../helpers/winston.logger');
const model = require('./loadbalance.model');
const moment = require('moment');
moment.locale('id');
// VALIDATION
const validate = (method) => {
switch (method) {
case 'loadingBalanceRequest':
return [
body('mid').not().isEmpty().withMessage('MID is required'),
body('tid').not().isEmpty().withMessage('TID is required'),
body('uid').not().isEmpty().withMessage('UID is required'),
body('flag').not().isEmpty().withMessage('Flag is required'),
body('card_number')
.not()
.isEmpty()
.withMessage('Card Number is required'),
];
case 'loadingBalance':
return [
body('mid').not().isEmpty().withMessage('MID is required'),
body('tid').not().isEmpty().withMessage('TID is required'),
body('uid').not().isEmpty().withMessage('UID is required'),
body('flag').not().isEmpty().withMessage('Flag is required'),
body('card_number')
.not()
.isEmpty()
.withMessage('Card Number is required'),
body('amount')
.not()
.isEmpty()
.withMessage('Amount is required')
.isNumeric()
.withMessage('Amount is invalid format'),
body('reservation_number')
.not()
.isEmpty()
.withMessage('Reservation Number is required')
.isArray()
.withMessage('Reservation Number is invalid request format'),
];
default:
break;
}
};
// ==================================================== FUNCTION UPDATE ALL TRANSACTION ======================================================
// *Created By: Mohamad Ihsan*