mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2025-12-19 05:47:46 +00:00
feat: support sorted set queues (#177)
* feat: support sorted set queues * fix: tune tests for queue
This commit is contained in:
4
app.js
4
app.js
@@ -33,7 +33,7 @@ const {
|
||||
retrieveCall,
|
||||
deleteCall,
|
||||
listCalls,
|
||||
listQueues,
|
||||
listSortedSets,
|
||||
purgeCalls,
|
||||
retrieveSet,
|
||||
addKey,
|
||||
@@ -78,7 +78,7 @@ app.locals = {
|
||||
retrieveCall,
|
||||
deleteCall,
|
||||
listCalls,
|
||||
listQueues,
|
||||
listSortedSets,
|
||||
purgeCalls,
|
||||
retrieveSet,
|
||||
addKey,
|
||||
|
||||
@@ -4,7 +4,7 @@ const {
|
||||
retrieveCall,
|
||||
deleteCall,
|
||||
listCalls,
|
||||
listQueues,
|
||||
listSortedSets,
|
||||
purgeCalls,
|
||||
retrieveSet,
|
||||
addKey,
|
||||
@@ -21,7 +21,7 @@ module.exports = {
|
||||
retrieveCall,
|
||||
deleteCall,
|
||||
listCalls,
|
||||
listQueues,
|
||||
listSortedSets,
|
||||
purgeCalls,
|
||||
retrieveSet,
|
||||
addKey,
|
||||
|
||||
@@ -896,12 +896,12 @@ router.post('/:sid/Messages', async(req, res) => {
|
||||
* retrieve info for a group of queues under an account
|
||||
*/
|
||||
router.get('/:sid/Queues', async(req, res) => {
|
||||
const {logger, listQueues} = req.app.locals;
|
||||
const {logger, listSortedSets} = req.app.locals;
|
||||
const { search } = req.query || {};
|
||||
try {
|
||||
const accountSid = parseAccountSid(req);
|
||||
await validateRequest(req, accountSid);
|
||||
const queues = search ? await listQueues(accountSid, search) : await listQueues(accountSid);
|
||||
const queues = search ? await listSortedSets(accountSid, search) : await listSortedSets(accountSid);
|
||||
logger.debug(`retrieved ${queues.length} queues for account sid ${accountSid}`);
|
||||
res.status(200).json(queues);
|
||||
updateLastUsed(logger, accountSid, req).catch((err) => {});
|
||||
|
||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -13,7 +13,7 @@
|
||||
"@deepgram/sdk": "^1.10.2",
|
||||
"@google-cloud/speech": "^5.1.0",
|
||||
"@jambonz/db-helpers": "^0.9.0",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.1",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.6",
|
||||
"@jambonz/speech-utils": "^0.0.14",
|
||||
"@jambonz/time-series": "^0.2.5",
|
||||
"@jambonz/verb-specifications": "^0.0.21",
|
||||
@@ -1790,9 +1790,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jambonz/realtimedb-helpers": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.8.1.tgz",
|
||||
"integrity": "sha512-SkF5+raJdSfzAdg82jvbQp11ioXrt1Dn456Urf/01y/Zp8jbAZKbiztxoh13lZ5Dvo6XjOuWNJVZQIIYVy0+aA==",
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.8.6.tgz",
|
||||
"integrity": "sha512-ODKVVat2VAQheY13DjiAxiBBOmffMoeu3xviTjsTODr3ySZkqQZvSWU7N80pAIZvoiWG1UUEy9yI8D8mE4Jgiw==",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
"ioredis": "^5.3.2"
|
||||
@@ -10358,9 +10358,9 @@
|
||||
}
|
||||
},
|
||||
"@jambonz/realtimedb-helpers": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.8.1.tgz",
|
||||
"integrity": "sha512-SkF5+raJdSfzAdg82jvbQp11ioXrt1Dn456Urf/01y/Zp8jbAZKbiztxoh13lZ5Dvo6XjOuWNJVZQIIYVy0+aA==",
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.8.6.tgz",
|
||||
"integrity": "sha512-ODKVVat2VAQheY13DjiAxiBBOmffMoeu3xviTjsTODr3ySZkqQZvSWU7N80pAIZvoiWG1UUEy9yI8D8mE4Jgiw==",
|
||||
"requires": {
|
||||
"debug": "^4.3.4",
|
||||
"ioredis": "^5.3.2"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"@deepgram/sdk": "^1.10.2",
|
||||
"@google-cloud/speech": "^5.1.0",
|
||||
"@jambonz/db-helpers": "^0.9.0",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.1",
|
||||
"@jambonz/realtimedb-helpers": "^0.8.6",
|
||||
"@jambonz/speech-utils": "^0.0.14",
|
||||
"@jambonz/time-series": "^0.2.5",
|
||||
"@jambonz/verb-specifications": "^0.0.21",
|
||||
|
||||
@@ -14,7 +14,7 @@ const {
|
||||
createPhoneNumber,
|
||||
deleteObjectBySid} = require('./utils');
|
||||
const logger = require('../lib/logger');
|
||||
const { pushBack } = require('@jambonz/realtimedb-helpers')({
|
||||
const { addToSortedSet } = require('@jambonz/realtimedb-helpers')({
|
||||
host: process.env.JAMBONES_REDIS_HOST,
|
||||
port: process.env.JAMBONES_REDIS_PORT || 6379
|
||||
}, logger);
|
||||
@@ -268,8 +268,8 @@ test('account tests', async(t) => {
|
||||
t.ok(result.statusCode === 204, 'successfully deleted a call session limit for an account');
|
||||
|
||||
/* query account queues */
|
||||
await pushBack(`queue:${sid}:test`, 'url1');
|
||||
await pushBack(`queue:${sid}:dummy`, 'url2');
|
||||
await addToSortedSet(`queue:${sid}:test`, 'url1');
|
||||
await addToSortedSet(`queue:${sid}:dummy`, 'url2');
|
||||
|
||||
result = await request.get(`/Accounts/${sid}/Queues`, {
|
||||
auth: authAdmin,
|
||||
|
||||
Reference in New Issue
Block a user