aggio numtransaction

This commit is contained in:
Surya Paolo
2024-01-09 08:34:28 +01:00
parent db81980046
commit 7ea6c2a76b
6 changed files with 87 additions and 3 deletions

View File

@@ -30,6 +30,9 @@ const AccountSchema = new Schema({
idapp: {
type: String,
},
numtransactions: {
type: Number,
},
username: {
type: String,
},
@@ -232,6 +235,11 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
myaccount.totTransato = 0;
}
myaccount.totTransato += Math.abs(amount);
if (!myaccount.numtransactions)
myaccount.numtransactions = 0;
myaccount.numtransactions++;
myaccount.date_updated = new Date();
myaccountupdate.saldo = myaccount.saldo;
@@ -308,6 +316,7 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
fidoConcesso: 0,
qta_maxConcessa: 0,
totTransato: 0,
numtransactions: 0,
totTransato_pend: 0,
});

View File

@@ -716,7 +716,6 @@ module.exports.updateCmd = async function (ordersCart, status, value, req, optio
} else if (status === shared_consts.OrderStatus.PAYED) {
if (value) {
// myOrderCart.pagato = false;
if (!myOrderCart.pagato) { // Se ancora non è stato confermato:
await OrdersCart.addOrderToMovement(myOrderCart, usernameStore, groupnameStore, req);

View File

@@ -646,7 +646,7 @@ router.post('/login', (req, res) => {
console.error('ERRORE IN LOGIN: ' + e.message);
if (!resalreadysent)
res.status(400).
send({ code: server_constants.RIS_CODE_LOGIN_ERR_GENERIC });
send({ code: server_constants.RIS_CODE_LOGIN_ERR_GENERIC, msgerr: e.message });
});
});