@runnerpro/backend 1.12.13 → 1.12.16
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.
|
@@ -189,7 +189,6 @@ const getConversationFile = (req, res, { bucket, isClient }) => __awaiter(void 0
|
|
|
189
189
|
});
|
|
190
190
|
if (!result)
|
|
191
191
|
return res.status(404).send('Not found');
|
|
192
|
-
console.log(result);
|
|
193
192
|
res.writeHead(200, {
|
|
194
193
|
'Content-Type': result.message.text,
|
|
195
194
|
'Content-disposition': 'inline',
|
|
@@ -204,7 +203,6 @@ const getChatFile = ({ bucket, id, isClient, userid }) => __awaiter(void 0, void
|
|
|
204
203
|
isClient,
|
|
205
204
|
userid,
|
|
206
205
|
]);
|
|
207
|
-
console.log({ message });
|
|
208
206
|
if (!message)
|
|
209
207
|
return null;
|
|
210
208
|
try {
|
|
@@ -216,9 +214,10 @@ const getChatFile = ({ bucket, id, isClient, userid }) => __awaiter(void 0, void
|
|
|
216
214
|
}
|
|
217
215
|
});
|
|
218
216
|
const sendMessage = (req, res, { sendNotification, firebaseMessaging, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
219
|
-
const { text, replyMessageId } = req.body;
|
|
217
|
+
const { text, replyMessageId, new: newMessage } = req.body;
|
|
220
218
|
const { userid } = req.session;
|
|
221
219
|
const idCliente = isClient ? req.session.userid : req.body.idCliente;
|
|
220
|
+
let idWorkout;
|
|
222
221
|
// Si es entrenador, se marca leído cuando se envía un mensaje
|
|
223
222
|
if (!isClient)
|
|
224
223
|
yield markReadMessage({ isClient, idCliente });
|
|
@@ -228,6 +227,11 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, isClient }
|
|
|
228
227
|
idCliente,
|
|
229
228
|
isClient,
|
|
230
229
|
});
|
|
230
|
+
console.log(req.body);
|
|
231
|
+
// Enviado cuando es un mensaje de comentario sobre intelligence
|
|
232
|
+
if (newMessage) {
|
|
233
|
+
console.log('es new Message');
|
|
234
|
+
}
|
|
231
235
|
const [message] = yield (0, index_1.query)('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [REPLY MESSAGE ID], [TYPE]) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING [ID]', [isClient ? userid : idCliente, userid, textSpanish, textPreferredLanguage, preferredLanguage, replyMessageId, 1]);
|
|
232
236
|
res.send({ idMessage: message.id });
|
|
233
237
|
if (!isClient) {
|
|
@@ -275,7 +279,6 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, isClient, buc
|
|
|
275
279
|
[duration, thumbnail] = yield Promise.all([getVideoDuration(filePath), getThumbnailFromVideo(filePath)]);
|
|
276
280
|
}
|
|
277
281
|
const [{ id: idFile }] = yield (0, index_1.query)('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [MIMETYPE], [DURATION], [TYPE]) VALUES (?, ?, ?, ?, ?, ?) RETURNING [ID]', [isClient ? userid : idCliente, userid, req.file.originalname, req.file.mimetype, duration || null, type || 2]);
|
|
278
|
-
res.send({ idFile });
|
|
279
282
|
const fileData = fs_1.default.readFileSync(filePath);
|
|
280
283
|
const files = [];
|
|
281
284
|
if (req.file.mimetype.includes('image')) {
|
|
@@ -299,6 +302,7 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, isClient, buc
|
|
|
299
302
|
for (const file of files) {
|
|
300
303
|
yield bucket.file(`Chat/${file.id}`).save(file.data);
|
|
301
304
|
}
|
|
305
|
+
res.send({ idFile });
|
|
302
306
|
fs_1.default.unlinkSync(filePath);
|
|
303
307
|
if (!isClient) {
|
|
304
308
|
const [cliente] = yield (0, index_1.query)('SELECT [PREFERRED LANGUAGE] FROM [CLIENTE] WHERE [ID] = ?', [idCliente]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAuBpD,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAuBpD,CAAC;AAmZF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|