2021-09-22 01:13:41 +02:00
|
|
|
const mongoose = require('mongoose').set('debug', false)
|
2021-04-30 01:31:12 +02:00
|
|
|
const Schema = mongoose.Schema;
|
|
|
|
|
|
|
|
|
|
const tools = require('../tools/general');
|
|
|
|
|
|
|
|
|
|
mongoose.Promise = global.Promise;
|
|
|
|
|
mongoose.level = "F";
|
|
|
|
|
|
2021-09-22 01:13:41 +02:00
|
|
|
mongoose.set('debug', false);
|
|
|
|
|
|
2021-04-30 01:31:12 +02:00
|
|
|
// Resolving error Unknown modifier: $pushAll
|
|
|
|
|
mongoose.plugin(schema => {
|
|
|
|
|
schema.options.usePushEach = true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const SiteSchema = new Schema({
|
|
|
|
|
active: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
|
|
|
|
idapp: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
name: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
adminemail: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
manageremail: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
replyTo: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
host: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2022-01-07 01:18:01 +01:00
|
|
|
host_test: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2021-04-30 01:31:12 +02:00
|
|
|
portapp: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
dir: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2022-01-07 01:18:01 +01:00
|
|
|
dir_test: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2021-04-30 01:31:12 +02:00
|
|
|
email_from: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
email_pwd: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
telegram_key: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
telegram_bot_name: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2022-01-07 01:18:01 +01:00
|
|
|
telegram_key_test: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
telegram_bot_name_test: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2021-04-30 01:31:12 +02:00
|
|
|
pathreg_add: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
2022-01-07 01:18:01 +01:00
|
|
|
ask_to_verify_reg: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
},
|
2021-12-21 01:27:45 +01:00
|
|
|
who: {
|
|
|
|
|
type: String
|
|
|
|
|
},
|
|
|
|
|
status: {
|
|
|
|
|
type: String
|
|
|
|
|
},
|
|
|
|
|
note: {
|
|
|
|
|
type: String
|
|
|
|
|
},
|
|
|
|
|
domain_provider: {
|
|
|
|
|
type: String,
|
|
|
|
|
},
|
|
|
|
|
domain_expiring: {
|
|
|
|
|
type: Date
|
|
|
|
|
},
|
|
|
|
|
next_payment: {
|
|
|
|
|
type: Date
|
|
|
|
|
},
|
2021-04-30 01:31:12 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var Site = module.exports = mongoose.model('Site', SiteSchema);
|
|
|
|
|
|
|
|
|
|
module.exports.getFieldsForSearch = function () {
|
|
|
|
|
return []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports.executeQueryTable = async function (idapp, params) {
|
|
|
|
|
params.fieldsearch = this.getFieldsForSearch();
|
|
|
|
|
// return tools.executeQueryTable(this, null, params);
|
|
|
|
|
|
|
|
|
|
const myarr = await Site.find({});
|
|
|
|
|
|
|
|
|
|
return ({ count: myarr.length, rows: myarr })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports.findAllIdApp = async function (idapp) {
|
|
|
|
|
|
|
|
|
|
const myfind = { active: true };
|
|
|
|
|
|
2021-09-22 01:13:41 +02:00
|
|
|
return Site.find(myfind);
|
|
|
|
|
|
2021-04-30 01:31:12 +02:00
|
|
|
};
|