@runnerpro/backend 1.8.17 → 1.8.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.saveResponseTime = void 0;
13
13
  const index_1 = require("../db/index");
14
14
  const saveResponseTime = ({ isClient, idCliente }) => __awaiter(void 0, void 0, void 0, function* () {
15
+ console.log('saveResponseTime', isClient, idCliente);
15
16
  if (isClient)
16
17
  return;
17
18
  let lastNotReadMessage;
@@ -23,7 +24,8 @@ const saveResponseTime = ({ isClient, idCliente }) => __awaiter(void 0, void 0,
23
24
  WHERE [ID CLIENTE] = ? AND [ID] < ?
24
25
  ORDER BY [DATE] DESC
25
26
  LIMIT 1
26
- `, [idCliente, lastNotReadMessage === null || lastNotReadMessage === void 0 ? void 0 : lastNotReadMessage.id]);
27
+ `, [idCliente, (lastNotReadMessage === null || lastNotReadMessage === void 0 ? void 0 : lastNotReadMessage.id) || 2147483646]);
28
+ console.log('lastMessage', lastMessage);
27
29
  // Si no hay más mensajes || el mensaje no es del cliente || ya tiene tiempo de respuesta => salimos del bucle
28
30
  if (!lastMessage || (lastMessage.idSender && lastMessage.idCliente !== lastMessage.idSender) || lastMessage.tiempoRespuesta)
29
31
  break;
@@ -31,10 +33,12 @@ const saveResponseTime = ({ isClient, idCliente }) => __awaiter(void 0, void 0,
31
33
  if (!firstNotReadMessage)
32
34
  firstNotReadMessage = lastMessage; // Se guarda el primer mensaje no leído para añadir en este el tiempo de respuesta
33
35
  }
36
+ console.log('lastNotReadMessage final', lastNotReadMessage);
34
37
  if (!lastNotReadMessage)
35
38
  return;
36
39
  // @ts-ignore
37
40
  const responseTime = Math.floor((new Date() - new Date(lastNotReadMessage.date)) / 1000);
41
+ console.log('responseTime', responseTime, firstNotReadMessage.id);
38
42
  yield (0, index_1.query)('UPDATE [CHAT MESSAGE] SET [TIEMPO RESPUESTA] = ? WHERE [ID] = ?', [responseTime, firstNotReadMessage.id]);
39
43
  });
40
44
  exports.saveResponseTime = saveResponseTime;
@@ -49,8 +49,6 @@ function notificationWEB(firebaseMessaging, msg, token) {
49
49
  data: msg,
50
50
  });
51
51
  }
52
- catch (error) {
53
- console.log('Error al enviar notificación', error);
54
- }
52
+ catch (error) { }
55
53
  });
56
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"saveResponseTime.d.ts","sourceRoot":"","sources":["../../../../src/chat/saveResponseTime.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,gBAAgB;;;mBA6BrB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"saveResponseTime.d.ts","sourceRoot":"","sources":["../../../../src/chat/saveResponseTime.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,gBAAgB;;;mBAmCrB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY,kBA8Bd,CAAC;AAuBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY,kBA8Bd,CAAC;AAqBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.8.17",
3
+ "version": "1.8.19",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"