mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
* added private_newtwork_cidr to system_information table * db schema upgrade to add system_information.private_network_cidr in 0.9.2 * increase size of system_information.private_network_cidr to varchar(8192)
43 lines
874 B
JavaScript
43 lines
874 B
JavaScript
const Model = require('./model');
|
|
const { promisePool } = require('../db');
|
|
class SystemInformation extends Model {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
static async add(body) {
|
|
let [sysInfo] = await this.retrieveAll();
|
|
if (sysInfo) {
|
|
const sql = `UPDATE ${this.table} SET ?`;
|
|
await promisePool.query(sql, body);
|
|
} else {
|
|
const sql = `INSERT INTO ${this.table} SET ?`;
|
|
await promisePool.query(sql, body);
|
|
}
|
|
[sysInfo] = await this.retrieveAll();
|
|
return sysInfo;
|
|
}
|
|
}
|
|
|
|
SystemInformation.table = 'system_information';
|
|
SystemInformation.fields = [
|
|
{
|
|
name: 'domain_name',
|
|
type: 'string',
|
|
},
|
|
{
|
|
name: 'sip_domain_name',
|
|
type: 'string',
|
|
},
|
|
{
|
|
name: 'monitoring_domain_name',
|
|
type: 'string',
|
|
},
|
|
{
|
|
name: 'private_network_cidr',
|
|
type: 'string',
|
|
},
|
|
];
|
|
|
|
module.exports = SystemInformation;
|