mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-01-25 02:08:24 +00:00
Compare commits
6 Commits
v0.7.6-rc4
...
fix-return
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81def62a03 | ||
|
|
b60fd4bbc4 | ||
|
|
08163a31d0 | ||
|
|
1898ba501d | ||
|
|
6f52202deb | ||
|
|
0ceb79b568 |
@@ -577,6 +577,6 @@ ALTER TABLE accounts ADD FOREIGN KEY queue_event_hook_sid_idxfk (queue_event_hoo
|
||||
|
||||
ALTER TABLE accounts ADD FOREIGN KEY device_calling_application_sid_idxfk (device_calling_application_sid) REFERENCES applications (application_sid);
|
||||
|
||||
ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES webhooks (webhook_sid);
|
||||
ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
|
||||
@@ -1580,14 +1580,14 @@
|
||||
<SQLField>
|
||||
<name><![CDATA[siprec_hook_sid]]></name>
|
||||
<type><![CDATA[CHAR(36)]]></type>
|
||||
<referencesField>webhook_sid</referencesField>
|
||||
<referencesTable>webhooks</referencesTable>
|
||||
<referencesField><![CDATA[webhook_sid]]></referencesField>
|
||||
<referencesTable><![CDATA[webhooks]]></referencesTable>
|
||||
<referencesField>application_sid</referencesField>
|
||||
<referencesTable>applications</referencesTable>
|
||||
<referencesField><![CDATA[application_sid]]></referencesField>
|
||||
<referencesTable><![CDATA[applications]]></referencesTable>
|
||||
<sourceCardinality>4</sourceCardinality>
|
||||
<destinationCardinality>2</destinationCardinality>
|
||||
<referencesFieldUID><![CDATA[E046BA30-BC18-483C-A5C8-766E7160F574]]></referencesFieldUID>
|
||||
<referencesTableUID><![CDATA[64D64CB9-0990-4C68-BE71-F9FD43C2BE19]]></referencesTableUID>
|
||||
<destinationCardinality>1</destinationCardinality>
|
||||
<referencesFieldUID><![CDATA[EF943D13-DCB0-43C1-B03F-550612E20F9D]]></referencesFieldUID>
|
||||
<referencesTableUID><![CDATA[E97EE4F0-7ED7-4E8C-862E-D98192D6EAE0]]></referencesTableUID>
|
||||
<uid><![CDATA[4B8283B4-5E16-4846-A79D-12C6B2E73C86]]></uid>
|
||||
</SQLField>
|
||||
<labelWindowIndex><![CDATA[25]]></labelWindowIndex>
|
||||
|
||||
@@ -24,7 +24,9 @@ const opts = {
|
||||
|
||||
const sql = {
|
||||
'7006': [
|
||||
'ALTER TABLE `accounts` ADD COLUMN `siprec_hook_sid` CHAR(36)'
|
||||
'ALTER TABLE `accounts` ADD COLUMN `siprec_hook_sid` CHAR(36)',
|
||||
// eslint-disable-next-line max-len
|
||||
'ALTER TABLE accounts ADD FOREIGN KEY siprec_hook_sid_idxfk (siprec_hook_sid) REFERENCES applications (application_sid)'
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -314,6 +314,10 @@ Account.fields = [
|
||||
name: 'subspace_sip_teleport_destinations',
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
name: 'siprec_hook_sid',
|
||||
type: 'string',
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = Account;
|
||||
|
||||
@@ -104,7 +104,7 @@ router.get('/:sid', async(req, res) => {
|
||||
const account_sid = req.user.hasAccountAuth ? req.user.account_sid : null;
|
||||
const results = await Application.retrieve(req.params.sid, service_provider_sid, account_sid);
|
||||
if (results.length === 0) return res.status(404).end();
|
||||
return res.status(200).json(results);
|
||||
return res.status(200).json(results[0]);
|
||||
}
|
||||
catch (err) {
|
||||
sysError(logger, res, err);
|
||||
|
||||
@@ -1346,6 +1346,12 @@ paths:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
account_sid:
|
||||
type: string
|
||||
format: uuid
|
||||
application_sid:
|
||||
type: string
|
||||
format: uuid
|
||||
number:
|
||||
type: string
|
||||
description: telephone number
|
||||
|
||||
@@ -60,8 +60,8 @@ test('application tests', async(t) => {
|
||||
auth: authAdmin,
|
||||
json: true,
|
||||
});
|
||||
t.ok(result[0].name === 'daveh' , 'successfully retrieved application by sid');
|
||||
t.ok(result[0].messaging_hook.url === 'http://example.com/sms' , 'successfully retrieved messaging_hook from application');
|
||||
t.ok(result.name === 'daveh' , 'successfully retrieved application by sid');
|
||||
t.ok(result.messaging_hook.url === 'http://example.com/sms' , 'successfully retrieved messaging_hook from application');
|
||||
|
||||
/* update applications */
|
||||
result = await request.put(`/Applications/${sid}`, {
|
||||
@@ -84,7 +84,7 @@ test('application tests', async(t) => {
|
||||
auth: authAdmin,
|
||||
json: true,
|
||||
});
|
||||
t.ok(result[0].messaging_hook.url === 'http://example2.com/mms' , 'successfully updated messaging_hook');
|
||||
t.ok(result.messaging_hook.url === 'http://example2.com/mms' , 'successfully updated messaging_hook');
|
||||
|
||||
/* assign phone number to application */
|
||||
result = await request.put(`/PhoneNumbers/${phone_number_sid}`, {
|
||||
|
||||
@@ -318,7 +318,7 @@ test('authentication tests', async(t) => {
|
||||
json: true
|
||||
});
|
||||
//console.log(`result: ${JSON.stringify(result)}`);
|
||||
t.ok(result.length === 1, 'using account token A1 we are able to retrieve application A1');
|
||||
t.ok(result.name === "A1-app", 'using account token A1 we are able to retrieve application A1');
|
||||
|
||||
/* cannot see app under another account using account token */
|
||||
result = await request.get(`/Applications/${appA2}`, {
|
||||
|
||||
Reference in New Issue
Block a user