budgetAdd: problematic req.headers & placeholder projectSearch*
Signed-off-by: supphakitd <67319010028@technictrang.ac.th>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { AccountingSearchService } from '../services/accountingSearchService.js'
|
||||
import { BudgetAddService } from '../services/budgetAddService.js'
|
||||
import { sendError } from '../utils/response.js'
|
||||
// import { OftenError } from '../utils/oftenError.js'
|
||||
import { GeneralService } from '../share/generalservice.js';
|
||||
@@ -7,36 +7,33 @@ import { verifyToken, generateToken } from '../utils/token.js'
|
||||
import { Interface } from '../interfaces/Interface.js';
|
||||
|
||||
|
||||
export class accountingSearch {
|
||||
export class budgetAdd {
|
||||
|
||||
constructor() {
|
||||
this.generalService = new GeneralService();
|
||||
this.Interface = new Interface();
|
||||
this.accountingSearchService = new AccountingSearchService();
|
||||
this.budgetAddService = new BudgetAddService();
|
||||
}
|
||||
|
||||
async onNavigate(req, res) {
|
||||
this.generalService.devhint(1, 'accountingSearch.js', 'onNavigate() start');
|
||||
this.generalService.devhint(1, 'budgetAdd.js', 'onNavigate() start');
|
||||
let organization = req.body.organization;
|
||||
const prommis = await this.onAccountingSearch(req, res, organization);
|
||||
const prommis = await this.onBudgetAdd(req, res, organization);
|
||||
return prommis;
|
||||
}
|
||||
|
||||
async onAccountingSearch(req, res, database) {
|
||||
async onBudgetAdd(req, res, database) {
|
||||
let idx = -1
|
||||
let aryResult = []
|
||||
try {
|
||||
// let username = req.body.request.username;
|
||||
// let password = req.body.request.password;
|
||||
let token = req.body.request.token;
|
||||
const decoded = verifyToken(token);
|
||||
|
||||
let id = decoded.id
|
||||
let username = decoded.name
|
||||
let id = decoded.bdgseq
|
||||
database = decoded.organization
|
||||
|
||||
aryResult = await this.accountingSearchService.getAccountingSearch(database, id, username); // เช็คกับ db กลาง ส่ง jwttoken ออกมา
|
||||
// this.generalService.devhint(1, 'accountingSearch.js', 'Login success');
|
||||
aryResult = await this.budgetAddService.getBudgetAdd(database, id); // เช็คกับ db กลาง ส่ง jwttoken ออกมา
|
||||
// this.generalService.devhint(1, 'budgetSearch.js', 'Login success');
|
||||
} catch (error) {
|
||||
idx = 1;
|
||||
} finally {
|
||||
@@ -54,8 +51,8 @@ export class accountingSearch {
|
||||
let arysave = {
|
||||
methods: 'post',
|
||||
bdgseq: req.body.request.bdgseq,
|
||||
bdgttl: req.body.request.bdgseq
|
||||
bdgttl: req.body.request.bdgttl
|
||||
}
|
||||
return this.Interface.saveInterface('bdgmst', arysave);
|
||||
return this.Interface.saveInterface('bdgmst', req, arysave);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user