This commit is contained in:
Quan HL
2025-05-30 14:22:20 +07:00
parent a4342f2e68
commit 9d89d35473
+3
View File
@@ -12,6 +12,9 @@ class VoipCarrier extends Model {
static _criteriaBuilder(obj, args) {
let sql = '';
if (obj.account_sid) {
// carrier belong to an account when
// 1. account_sid is set
// 2. account_sid is null and service_provider_sid matches the account's service_provider_sid
sql += ` AND (vc.account_sid = ? OR
(vc.account_sid IS NULL AND vc.service_provider_sid IN
(SELECT service_provider_sid FROM accounts WHERE account_sid = ?))