@runnerpro/backend 1.8.9 → 1.8.11
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.
|
@@ -16,10 +16,16 @@ const index_2 = require("../sendNotification/index");
|
|
|
16
16
|
const index_3 = require("../db/index");
|
|
17
17
|
const common_1 = require("@runnerpro/common");
|
|
18
18
|
const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferredLanguage, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
const { notification } = options;
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
19
|
+
const { notification, entrenador } = options;
|
|
20
|
+
let idEntrenador;
|
|
21
|
+
if (entrenador)
|
|
22
|
+
idEntrenador = entrenador;
|
|
23
|
+
else {
|
|
24
|
+
const [entrenadorBBDD] = yield (0, index_3.query)('SELECT [ID ENTRENADOR] FROM [CLIENTE ENTRENADOR] WHERE [ID CLIENTE] = ? LIMIT 1', [idCliente]);
|
|
25
|
+
if (!entrenadorBBDD)
|
|
26
|
+
return;
|
|
27
|
+
idEntrenador = entrenadorBBDD.idEntrenador;
|
|
28
|
+
}
|
|
23
29
|
if (notification) {
|
|
24
30
|
try {
|
|
25
31
|
yield (0, index_2.sendNotification)({
|
|
@@ -30,9 +36,12 @@ const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferr
|
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
catch (e) {
|
|
39
|
+
console.log('Error al enviar notificación', e);
|
|
33
40
|
(0, index_1.err)(null, null, e, null);
|
|
41
|
+
return e;
|
|
34
42
|
}
|
|
35
43
|
}
|
|
36
|
-
yield (0, index_3.query)('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [TYPE]) VALUES (?, ?, ?, ?, ?, 1)', [idCliente,
|
|
44
|
+
yield (0, index_3.query)('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [TYPE]) VALUES (?, ?, ?, ?, ?, 1)', [idCliente, idEntrenador, text, textPreferredLanguage, preferredLanguage]);
|
|
45
|
+
return 'ok';
|
|
37
46
|
});
|
|
38
47
|
exports.sendMessageChatToClient = sendMessageChatToClient;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const sendMessageChatToClient: (idCliente: any, text: any, textPreferredLanguage: any, preferredLanguage: any, options: any) => Promise<
|
|
1
|
+
declare const sendMessageChatToClient: (idCliente: any, text: any, textPreferredLanguage: any, preferredLanguage: any, options: any) => Promise<any>;
|
|
2
2
|
export { sendMessageChatToClient };
|
|
3
3
|
//# sourceMappingURL=sendMessageChatToClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,uBAAuB,+GA8B5B,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|