Browse Source

fix(api): fix sentSMSCount update issue

pull/19/head
isra el 2 years ago
parent
commit
c16f37740a
  1. 12
      api/src/gateway/gateway.service.ts

12
api/src/gateway/gateway.service.ts

@ -98,11 +98,13 @@ export class GatewayService {
.messaging() .messaging()
.sendToDevice(device.fcmToken, payload, { priority: 'high' }) .sendToDevice(device.fcmToken, payload, { priority: 'high' })
this.deviceModel.findByIdAndUpdate(
deviceId,
{ $inc: { sentSMSCount: 1 } },
{ new: true },
)
this.deviceModel
.findByIdAndUpdate(deviceId, { $inc: { sentSMSCount: 1 } })
.exec()
.catch((e) => {
console.log('Failed to update sentSMSCount')
console.log(e)
})
return response return response
} catch (e) { } catch (e) {
throw new HttpException( throw new HttpException(

Loading…
Cancel
Save