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
+2 -52
View File
@@ -4,61 +4,11 @@ const bcrypt = require('bcrypt');
const helper = require('../../helpers/helper');
const winston = require('../../helpers/winston.logger');
const model = require('./auth.model');
const { body, validationResult } = require('express-validator');
const { validationResult } = require('express-validator');
const validate = require('./auth.validation');
const moment = require('moment');
moment.locale('id');
// VALIDATION
const validate = (method) => {
switch (method) {
case 'loginPartnerUser': {
return [
body('email')
.not()
.isEmpty()
.withMessage('Email is required')
.isEmail()
.withMessage('Email format wrong'),
body('password').not().isEmpty().withMessage('Password is required'),
];
}
case 'loginTerminal': {
return [
body('mid').not().isEmpty().withMessage('MID is required'),
body('tid').not().isEmpty().withMessage('TID is required'),
body('password').not().isEmpty().withMessage('Password is required'),
];
}
case 'register': {
return [
body('mid').not().isEmpty().withMessage('MID is required'),
body('tid').not().isEmpty().withMessage('TID is required'),
body('password')
.not()
.isEmpty()
.withMessage('Password is required')
.isLength({ min: 5 })
.withMessage('Password must be least 5 characters'),
];
}
case 'refreshTokenPartnerUser': {
return [
body('email')
.not()
.isEmpty()
.withMessage('Email is required')
.isEmail()
.withMessage('Email format wrong'),
];
}
case 'refreshTokenTerminal': {
return [
body('mid').not().isEmpty().withMessage('MID is required'),
body('tid').not().isEmpty().withMessage('TID is required'),
];
}
}
};
// ================================================================= LOGIN BY PARTNER USER =================================================================
// *Created By: Mohamad Ihsan*