Should not allow create phone_number on different voip_carrier and account (#394)

* shouldnt create phonenumber on different carrier and account

* wip
This commit is contained in:
Hoan Luu Huu
2025-03-06 19:40:54 +07:00
committed by GitHub
parent 5a02346c71
commit 2ac0da0d14

View File

@@ -40,6 +40,10 @@ async function validateAdd(req) {
if (!result || result.length === 0) {
throw new DbErrorBadRequest(`voip_carrier not found for sid ${req.body.voip_carrier_sid}`);
}
const carrier = result[0];
if (carrier.account_sid && req.body.account_sid && req.body.account_sid !== carrier.account_sid) {
throw new DbErrorBadRequest('voip_carrier_sid does not belong to the account');
}
}
}