Corretto Duplicazione Sito (es: da 1 a 14)

This commit is contained in:
Paolo Arena
2022-05-14 00:31:53 +02:00
parent 6bee532b9b
commit bedd724523
12 changed files with 72 additions and 46 deletions

View File

@@ -4,6 +4,7 @@ const Schema = mongoose.Schema;
mongoose.Promise = global.Promise;
mongoose.level = "F";
const tools = require('../tools/general');
const { ObjectID } = require('mongodb');
// Resolving error Unknown modifier: $pushAll
@@ -11,7 +12,7 @@ mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const cfgserverSchema = new Schema({
const CfgServerSchema = new Schema({
chiave: {
type: String,
trim: true,
@@ -28,4 +29,19 @@ const cfgserverSchema = new Schema({
},
});
mongoose.model('cfgserver', cfgserverSchema);
CfgServerSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
return tools.DuplicateAllRecords(this, idapporig, idappdest);
};
CfgServerSchema.statics.findAllIdApp = async function(idapp) {
const myfind = { idapp };
return await CfgServer.find(myfind).lean();
};
const CfgServer = mongoose.model('CfgServer', CfgServerSchema);
module.exports = {CfgServer};