/var/www/myprog.com.ua/server/node/objects
Edit: /var/www/myprog.com.ua/server/node/objects/command_history.js (1042B)
//const User = require('./user');
const microtime = require('../helpers/date');
class CommandHistory {
constructor(data) {
// db fields
this.id = 0;
this.command_id = 0;
this.v = '';
this.last_date = '';
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 = CommandHistory;