From 7a09680a912c4729589fb3bc7fd2aef928de2596 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 30 Oct 2023 20:20:35 +0700 Subject: [PATCH] wip --- lib/models/google-custom-voice.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/models/google-custom-voice.js b/lib/models/google-custom-voice.js index 1ea86e06..36b2e6ca 100644 --- a/lib/models/google-custom-voice.js +++ b/lib/models/google-custom-voice.js @@ -23,11 +23,12 @@ class GoogleCustomVoice extends Model { if (account_sid) { sql = `SELECT gcv.* FROM ${this.table} gcv LEFT JOIN speech_credentials sc ON gcv.speech_credential_sid = sc.speech_credential_sid -WHERE sc.account_sid = ? OR (sc.account_sid is NULL && sc.service_provider_sid = ?) ${label ? 'AND label = ?' : ''}`; +WHERE sc.account_sid = ? OR (sc.account_sid is NULL && sc.service_provider_sid = ?) +${label ? 'AND label = ?' : 'AND label is NULL'}`; } else { sql = `SELECT gcv.* FROM ${this.table} gcv LEFT JOIN speech_credentials sc ON gcv.speech_credential_sid = sc.speech_credential_sid -WHERE sc.service_provider_sid = ? ${label ? 'AND label = ?' : ''}`; +WHERE sc.service_provider_sid = ? ${label ? 'AND label = ?' : 'AND label is NULL'}`; } const [rows] = await promisePool.query(sql, [...(account_sid ? [account_sid, service_provider_sid] : [service_provider_sid]), label]);