mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
* added schema changes for LCR * fix FK * first draft * force drop table * add testcases * swagger updated * update code * wip: add service provider LCR * fix userpermission on lcr * add lcr.is_active * remove FK constraints on lcr * wip * wip * wip * fix: review comments * fix: final review * fix: final review * fix: update database schema * fix: update database schema * fix: update database schema * update schema * fix: review comments * lcr_routes.priority should not be unique * fix review comments --------- Co-authored-by: Quan HL <quan.luuhoang8@gmail.com>
48 lines
990 B
JavaScript
48 lines
990 B
JavaScript
const Model = require('./model');
|
|
const {promisePool} = require('../db');
|
|
|
|
class LcrCarrierSetEntry extends Model {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
static async retrieveAllByLcrRouteSid(sid) {
|
|
const sql = `SELECT * FROM ${this.table} WHERE lcr_route_sid = ? ORDER BY priority`;
|
|
const [rows] = await promisePool.query(sql, sid);
|
|
return rows;
|
|
}
|
|
|
|
static async deleteByLcrRouteSid(sid) {
|
|
const sql = `DELETE FROM ${this.table} WHERE lcr_route_sid = ?`;
|
|
const [rows] = await promisePool.query(sql, sid);
|
|
return rows.affectedRows;
|
|
}
|
|
}
|
|
|
|
LcrCarrierSetEntry.table = 'lcr_carrier_set_entry';
|
|
LcrCarrierSetEntry.fields = [
|
|
{
|
|
name: 'lcr_carrier_set_entry_sid',
|
|
type: 'string',
|
|
primaryKey: true
|
|
},
|
|
{
|
|
name: 'workload',
|
|
type: 'number'
|
|
},
|
|
{
|
|
name: 'lcr_route_sid',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'voip_carrier_sid',
|
|
type: 'string'
|
|
},
|
|
{
|
|
name: 'priority',
|
|
type: 'number'
|
|
}
|
|
];
|
|
|
|
module.exports = LcrCarrierSetEntry;
|