- ver 1.1.15
This commit is contained in:
@@ -127,6 +127,12 @@ const CircuitSchema = new Schema({
|
||||
qta_max_default_grp: {
|
||||
type: Number,
|
||||
},
|
||||
fido_scoperto_default_contocom: {
|
||||
type: Number,
|
||||
},
|
||||
qta_max_default_contocom: {
|
||||
type: Number,
|
||||
},
|
||||
data_costituz: {
|
||||
type: Date,
|
||||
},
|
||||
|
||||
@@ -2219,7 +2219,7 @@ UserSchema.statics.removeFromCircuits = async function (idapp, username, circuit
|
||||
if (myaccount && myaccount.totTransato === 0) {
|
||||
remove = true;
|
||||
} else {
|
||||
remove = true;
|
||||
remove = false;
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
@@ -3045,33 +3045,8 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
|
||||
outres.result = await Circuit.getInfoCircuitByName(idapp, circuitname);
|
||||
}
|
||||
} else {
|
||||
const foundIfAlreadyCircuit = await this.ifAlreadyInCircuit(idapp, usernameOrig, circuitname);
|
||||
|
||||
if (!foundIfAlreadyCircuit) {
|
||||
update = {
|
||||
$push: {
|
||||
'profile.mycircuits': {
|
||||
circuitname,
|
||||
date: new Date(),
|
||||
},
|
||||
},
|
||||
};
|
||||
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
|
||||
|
||||
// Elimina la richiesta:
|
||||
update = { $pull: { req_users: { username: { $in: [usernameOrig] } } } };
|
||||
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||
|
||||
// Elimina eventualmente se era bloccato:
|
||||
update = { $pull: { refused_users: { username: { $in: [usernameOrig] } } } };
|
||||
await Circuit.updateOne({ idapp, name: circuitname }, update);
|
||||
|
||||
await Account.createAccount(idapp, usernameOrig, circuitname);
|
||||
|
||||
|
||||
} else {
|
||||
ris = false;
|
||||
}
|
||||
ris = await this.addCircuitToUser(idapp, usernameOrig, circuitname, true, '');
|
||||
|
||||
await Circuit.updateData(idapp, circuitname)
|
||||
if (ris) {
|
||||
|
||||
@@ -1713,7 +1713,7 @@ router.post('/duprec/:table/:id', authenticate, async (req, res) => {
|
||||
|
||||
return await mytable.findById(id).then(async (mydata) => {
|
||||
|
||||
const datadup = tools.CloneRecordToNew(mydata);
|
||||
const datadup = tools.CloneRecordToNew(mydata, mytable.modelName);
|
||||
const mynewrec = new mytable(datadup);
|
||||
|
||||
return await mynewrec.save().then(async (rec) => {
|
||||
|
||||
@@ -842,11 +842,16 @@ module.exports = {
|
||||
return JSON.parse(JSON.stringify(src));
|
||||
},
|
||||
|
||||
CloneRecordToNew(src) {
|
||||
CloneRecordToNew(src, modelTable) {
|
||||
const myrec = Object.assign({}, src);
|
||||
delete myrec._doc['_id'];
|
||||
myrec._id = new ObjectId();
|
||||
|
||||
if (modelTable === 'Circuit') {
|
||||
myrec._doc.name = myrec._doc.name + ' copia';
|
||||
myrec._doc.path = myrec._doc.path + '_copia';
|
||||
}
|
||||
|
||||
return myrec._doc;
|
||||
},
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.14
|
||||
1.1.15
|
||||
Reference in New Issue
Block a user