@runnerpro/backend 1.12.21 → 1.12.23
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.
|
@@ -276,10 +276,17 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, isClient, buc
|
|
|
276
276
|
const { userid } = req.session;
|
|
277
277
|
const filePath = path_1.default.join('./uploads', req.file.filename);
|
|
278
278
|
if (req.file.mimetype.includes('video')) {
|
|
279
|
+
console.time('getVideoDuration');
|
|
279
280
|
duration = yield getVideoDuration(filePath);
|
|
281
|
+
console.timeEnd('getVideoDuration');
|
|
282
|
+
console.time('getThumbnailFromVideo');
|
|
280
283
|
thumbnail = yield getThumbnailFromVideo(filePath, duration);
|
|
284
|
+
console.timeEnd('getThumbnailFromVideo');
|
|
281
285
|
}
|
|
286
|
+
console.time('query');
|
|
282
287
|
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]);
|
|
288
|
+
console.timeEnd('query');
|
|
289
|
+
console.time('readFileSync');
|
|
283
290
|
const fileData = fs_1.default.readFileSync(filePath);
|
|
284
291
|
const files = [];
|
|
285
292
|
if (req.file.mimetype.includes('image')) {
|
|
@@ -300,10 +307,13 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, isClient, buc
|
|
|
300
307
|
else {
|
|
301
308
|
files.push({ data: fileData, id: idFile });
|
|
302
309
|
}
|
|
310
|
+
console.timeEnd('readFileSync');
|
|
311
|
+
res.send({ idFile });
|
|
312
|
+
console.time('saveFile');
|
|
303
313
|
for (const file of files) {
|
|
304
314
|
yield bucket.file(`Chat/${file.id}`).save(file.data);
|
|
305
315
|
}
|
|
306
|
-
|
|
316
|
+
console.timeEnd('saveFile');
|
|
307
317
|
fs_1.default.unlinkSync(filePath);
|
|
308
318
|
if (!isClient) {
|
|
309
319
|
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;AA6aF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|