Skip to content

Commit

Permalink
Should not allow create phone_number on different voip_carrier and ac…
Browse files Browse the repository at this point in the history
…count (#394)

* shouldnt create phonenumber on different carrier and account

* wip
  • Loading branch information
xquanluu authored Mar 6, 2025
1 parent 5a02346 commit 2ac0da0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/routes/api/phone-numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
}

Expand Down

0 comments on commit 2ac0da0

Please sign in to comment.