@runnerpro/backend 1.4.2 → 1.4.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.
@@ -44,7 +44,6 @@ const conversationRoute = (_a) => {
44
44
  },
45
45
  });
46
46
  router.get('/conversation', (req, res, next) => getConversation(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
47
- router.post('/conversation/mark-as-read', (req, res, next) => markAsRead(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
48
47
  router.get('/conversation/suggestion', (req, res, next) => getConversationSuggestion(req, res).catch((error) => (0, index_1.err)(req, res, error, next)));
49
48
  router.get('/conversation/image/:id', (req, res, next) => getConversationImage(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
50
49
  router.get('/conversation/file/:id', (req, res, next) => getConversationFile(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
@@ -75,6 +74,7 @@ const getConversation = (req, res, { query, isClient }) => __awaiter(void 0, voi
75
74
  });
76
75
  }
77
76
  res.send({ header, messages });
77
+ console.log('read from getConversation');
78
78
  // Solo se marca como leído si es el cliente | El entrenador tiene el botón o enviar mensaje para marcar como leído
79
79
  if (isClient)
80
80
  yield markReadMessage({ isClient, query, idCliente });
@@ -130,11 +130,6 @@ const getChatFile = ({ query, bucket, id, isClient, userid }) => __awaiter(void
130
130
  return null;
131
131
  }
132
132
  });
133
- const markAsRead = (req, res, { query, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
134
- const { idCliente } = req.body;
135
- yield markReadMessage({ isClient, query, idCliente });
136
- res.send({ status: 'ok' });
137
- });
138
133
  const getConversationSuggestion = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
139
134
  let result;
140
135
  try {
@@ -185,6 +180,7 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, query, isC
185
180
  });
186
181
  }
187
182
  res.send({ status: 'ok' });
183
+ console.log('read from sendMessage');
188
184
  // Si es entrenador, se marca leído cuando se envía un mensaje
189
185
  if (!isClient)
190
186
  yield markReadMessage({ isClient, query, idCliente });
@@ -245,10 +241,12 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, query, isClie
245
241
  });
246
242
  const readMessage = (req, res, { query, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
247
243
  const { idCliente } = req.body;
244
+ console.log('read from readMessage');
248
245
  yield markReadMessage({ isClient, query, idCliente });
249
246
  res.send({ status: 'ok' });
250
247
  });
251
248
  const markReadMessage = ({ isClient, query, idCliente }) => __awaiter(void 0, void 0, void 0, function* () {
249
+ console.log({ isClient, idCliente });
252
250
  const conditionSender = isClient ? ' AND [ID SENDER] != ?' : ' AND [ID SENDER] = ?';
253
251
  yield query('UPDATE [CHAT MESSAGE] SET [READ] = TRUE WHERE [ID CLIENTE] = ? AND [READ] = FALSE ' + conditionSender, [idCliente, idCliente]);
254
252
  yield saveResponseTime({ query, isClient, idCliente });
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAoBpD,CAAC;AA6SF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAmBpD,CAAC;AA2SF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"