Feature/sp call limits (#63)

* add api for setting/querying call limits by account and sp

* update an account or sp limit if one exists rather than creating a new one
This commit is contained in:
Dave Horton
2022-09-20 13:12:28 +02:00
parent 052a19cfdc
commit 05c46c5f39
4 changed files with 19 additions and 4 deletions

View File

@@ -1,9 +1,17 @@
const Model = require('./model');
const {promisePool} = require('../db');
const sql = 'SELECT * FROM account_limits WHERE account_sid = ?';
class AccountLimits extends Model {
constructor() {
super();
}
static async retrieve(account_sid) {
const [rows] = await promisePool.query(sql, [account_sid]);
return rows;
}
}
AccountLimits.table = 'account_limits';

View File

@@ -1,9 +1,15 @@
const Model = require('./model');
const {promisePool} = require('../db');
const sql = 'SELECT * FROM service_provider_limits WHERE service_provider_sid = ?';
class ServiceProviderLimits extends Model {
constructor() {
super();
}
static async retrieve(service_provider_sid) {
const [rows] = await promisePool.query(sql, [service_provider_sid]);
return rows;
}
}
ServiceProviderLimits.table = 'service_provider_limits';