@runnerpro/backend 1.9.1 → 1.9.3

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.
@@ -15,8 +15,9 @@ const index_1 = require("../err/index");
15
15
  const index_2 = require("../sendNotification/index");
16
16
  const index_3 = require("../db/index");
17
17
  const common_1 = require("@runnerpro/common");
18
+ const saveResponseTime_1 = require("./saveResponseTime");
18
19
  const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferredLanguage, options) => __awaiter(void 0, void 0, void 0, function* () {
19
- const { notification, entrenador } = options;
20
+ const { notification, entrenador, markAsRead = true, saveResponseTime: canSaveResponseTime = true } = options;
20
21
  let idEntrenador;
21
22
  if (entrenador)
22
23
  idEntrenador = entrenador;
@@ -26,6 +27,16 @@ const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferr
26
27
  return;
27
28
  idEntrenador = entrenadorBBDD.idEntrenador;
28
29
  }
30
+ // Mark as read
31
+ if (markAsRead) {
32
+ yield (0, index_3.query)('UPDATE [CHAT MESSAGE] SET [READ] = TRUE WHERE [ID CLIENTE] = ? AND [READ] = FALSE AND ([ID SENDER] = ? OR [ID SENDER] IS NULL)', [
33
+ idCliente,
34
+ idCliente,
35
+ ]);
36
+ }
37
+ // Save response time
38
+ if (canSaveResponseTime)
39
+ yield (0, saveResponseTime_1.saveResponseTime)(idCliente);
29
40
  if (notification) {
30
41
  try {
31
42
  yield (0, index_2.sendNotification)({
@@ -25,6 +25,7 @@ const googleSheeIds = {
25
25
  NORTH_STAR: '1RkLAXb8iH-QKQ1MAeUZLpBN2lWvab4GMZkKbG-DNv64',
26
26
  INFLUENCER_BUTTON: '1wSxtowC1yUUgkYDKhY_Wci6nZeYz13PiZuA7H_1tRfs',
27
27
  CRM_LEADS: '1q_M8JyYZjAtNhTay-OoQfjePWM9biNNJqw4bCetdXgg',
28
+ COHORTES: '1-ZcGfpuJieYDmHFFSu1NGICK5iJVFBNFnKTMVkW3gXI',
28
29
  };
29
30
  // authenticate the service account
30
31
  const googleAuth = new googleapis_1.google.auth.JWT(credentials.client_email, null, credentials.private_key.replace(/\\n/g, '\n'), 'https://www.googleapis.com/auth/spreadsheets');
@@ -1 +1 @@
1
- {"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,uBAAuB,gHA2B5B,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,uBAAuB,gHAsC5B,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/googleSheet/index.ts"],"names":[],"mappings":"AA4BA,iBAAe,SAAS,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,eAAe,EAAE;;;;;;CAAA,gBAgBnG;AAED,QAAA,MAAM,eAAe;;;;;;;;;0BAiCpB,CAAC;AAGF,iBAAS,SAAS,CAAC,MAAM,KAAA,UAaxB;AAED,iBAAS,iBAAiB,CAAC,MAAM,KAAA,UAOhC;AAED,QAAA,MAAM,UAAU;;;;;;mBAkBf,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;mBAmBhB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/googleSheet/index.ts"],"names":[],"mappings":"AA6BA,iBAAe,SAAS,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,eAAe,EAAE;;;;;;CAAA,gBAgBnG;AAED,QAAA,MAAM,eAAe;;;;;;;;;0BAiCpB,CAAC;AAGF,iBAAS,SAAS,CAAC,MAAM,KAAA,UAaxB;AAED,iBAAS,iBAAiB,CAAC,MAAM,KAAA,UAOhC;AAED,QAAA,MAAM,UAAU;;;;;;mBAkBf,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;mBAmBhB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"