mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
* 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
42 lines
736 B
JavaScript
42 lines
736 B
JavaScript
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';
|
|
AccountLimits.fields = [
|
|
{
|
|
name: 'account_limits_sid',
|
|
type: 'string',
|
|
primaryKey: true
|
|
},
|
|
{
|
|
name: 'account_sid',
|
|
type: 'string',
|
|
required: true
|
|
},
|
|
{
|
|
name: 'category',
|
|
type: 'string',
|
|
required: true
|
|
},
|
|
{
|
|
name: 'quantity',
|
|
type: 'number',
|
|
required: true
|
|
}
|
|
];
|
|
|
|
module.exports = AccountLimits;
|