Files
jambonz-api-server/lib/models/account-limits.js
Dave Horton 05c46c5f39 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
2022-09-20 22:55:28 +02:00

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;