/var/www/myprog.com.ua/server/node/objects
Edit: /var/www/myprog.com.ua/server/node/objects/host_config.js (1028B)
//const User = require('./user');
const microtime = require('../helpers/date');
class HostConfig {
constructor(data) {
// db fields
this.id = 0;
this.host_id = 0;
this.key = 0;
this.value = '';
if (db_fields_names_order.length == 0) {
for (var i in this) {
db_fields_names_order.push(i);
}
}
// set order data from db
if (data) {
for (var i in this) {
if (data[i]) {
this[i] = data[i];
}
}
}
}
get_db_fields_names() {
return db_fields_names_order;
}
get_array() {
let array = [];
this.get_db_fields_names().forEach(k => {
array[k] = this[k];
})
return array;
}
get_json() {
let copy = {};
Object.assign(copy, this.get_array());
return JSON.stringify(copy);
}
}
let db_fields_names_order = [];
module.exports = HostConfig;