feat support multi speech credential with diff labels and same vendor (#218)

* feat support multi speech credential with diff labels and same vendor

* fix review comment

* wip

* fix review comments

* update verb spec version
This commit is contained in:
Hoan Luu Huu
2023-08-15 08:53:16 -04:00
committed by GitHub
parent de7b74f898
commit 7351f0ad68
8 changed files with 68 additions and 33 deletions
+15
View File
@@ -20,6 +20,17 @@ class SpeechCredential extends Model {
return rows;
}
static async isAvailableVendorAndLabel(service_provider_sid, account_sid, vendor, label) {
let sql;
if (account_sid) {
sql = 'SELECT * FROM speech_credentials WHERE account_sid = ? AND vendor = ? AND label = ?';
} else {
sql = 'SELECT * FROM speech_credentials WHERE service_provider_sid = ? AND vendor = ? AND label = ?';
}
const [rows] = await promisePool.query(sql, [account_sid ? account_sid : service_provider_sid, vendor, label]);
return rows;
}
static async disableStt(account_sid) {
await promisePool.execute('UPDATE speech_credentials SET use_for_stt = 0 WHERE account_sid = ?', [account_sid]);
}
@@ -86,6 +97,10 @@ SpeechCredential.fields = [
{
name: 'last_tested',
type: 'date'
},
{
name: 'label',
type: 'string'
}
];