Browse Source

fix(api): return error message if sms is not sent due to fcm failure

legacy-ui
isra el 1 year ago
parent
commit
b3d3389dca
  1. 13
      api/src/gateway/gateway.service.ts

13
api/src/gateway/gateway.service.ts

@ -185,9 +185,20 @@ export class GatewayService {
console.log(response)
if (response.successCount === 0) {
throw new HttpException(
{
success: false,
error: 'Failed to send SMS',
additionalInfo: response,
},
HttpStatus.BAD_REQUEST,
)
}
this.deviceModel
.findByIdAndUpdate(deviceId, {
$inc: { sentSMSCount: recipients.length },
$inc: { sentSMSCount: response.successCount },
})
.exec()
.catch((e) => {

Loading…
Cancel
Save