Files
freeplanet_serverside/src/server/models/site.js

103 lines
1.6 KiB
JavaScript
Raw Normal View History

const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
const tools = require('../tools/general');
mongoose.Promise = global.Promise;
mongoose.level = "F";
mongoose.set('debug', false);
// 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,
},
portapp: {
type: String,
},
dir: {
type: String,
},
email_from: {
type: String,
},
email_pwd: {
type: String,
},
telegram_key: {
type: String,
},
telegram_bot_name: {
type: String,
},
pathreg_add: {
type: String,
},
who: {
type: String
},
status: {
type: String
},
note: {
type: String
},
domain_provider: {
type: String,
},
domain_expiring: {
type: Date
},
next_payment: {
type: Date
},
});
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 };
return Site.find(myfind);
};