Filter phone numbers result (#227)

Co-authored-by: eglehelms <e.helms@cognigy.com>
Co-authored-by: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com>
This commit is contained in:
EgleH
2023-08-31 18:04:16 +02:00
committed by GitHub
parent 62cea3a9e9
commit d5f5e3a86f

View File

@@ -120,6 +120,9 @@ router.get('/:sid', async(req, res) => {
throw new DbErrorBadRequest('insufficient privileges');
}
}
if (req.user.hasAccountAuth && results.length > 1) {
return res.status(200).json(results.filter((r) => r.phone_number_sid === sid)[0]);
}
return res.status(200).json(results[0]);
}
catch (err) {