From c16f37740a6a2d831db3effed79479465161b55c Mon Sep 17 00:00:00 2001 From: isra el Date: Mon, 4 Mar 2024 19:01:52 +0300 Subject: [PATCH] fix(api): fix sentSMSCount update issue --- api/src/gateway/gateway.service.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api/src/gateway/gateway.service.ts b/api/src/gateway/gateway.service.ts index eb6caae..17a8ee9 100644 --- a/api/src/gateway/gateway.service.ts +++ b/api/src/gateway/gateway.service.ts @@ -98,11 +98,13 @@ export class GatewayService { .messaging() .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 } catch (e) { throw new HttpException(