@runnerpro/backend 1.8.5 → 1.8.7
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.
|
@@ -33,6 +33,7 @@ const index_1 = require("../../index");
|
|
|
33
33
|
const common_1 = require("@runnerpro/common");
|
|
34
34
|
const index_2 = require("../../locale/index");
|
|
35
35
|
const multer_1 = __importDefault(require("multer"));
|
|
36
|
+
const axios_1 = __importDefault(require("axios"));
|
|
36
37
|
const conversationRoute = (_a) => {
|
|
37
38
|
var { router } = _a, params = __rest(_a, ["router"]);
|
|
38
39
|
const uploadFile = (0, multer_1.default)({
|
|
@@ -159,6 +160,14 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, query, isC
|
|
|
159
160
|
body: `Rubén: ${textPreferredLanguage || textSpanish}`,
|
|
160
161
|
screen: common_1.NOTIFICATION_SCREEN_TYPES.CHAT,
|
|
161
162
|
});
|
|
163
|
+
// Enviar a N8N lo que ha escrito el entrenador
|
|
164
|
+
const [lastSuggestionMsg] = yield query('SELECT [ID] FROM [CHAT MESSAGE] WHERE [ID CLIENTE] = ? AND [SUGGESTION TEXT] IS NOT NULL ORDER BY [ID] DESC LIMIT 1', [idCliente]);
|
|
165
|
+
if (lastSuggestionMsg) {
|
|
166
|
+
yield axios_1.default.put(`${process.env.N8N_URL}/edc2484f-7010-44c1-8c1d-82924496a2eb`, {
|
|
167
|
+
id: lastSuggestionMsg.id,
|
|
168
|
+
msg: textSpanish,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
162
171
|
}
|
|
163
172
|
res.send({ status: 'ok' });
|
|
164
173
|
});
|
|
@@ -14,11 +14,21 @@ const index_1 = require("../db/index");
|
|
|
14
14
|
const common_1 = require("@runnerpro/common");
|
|
15
15
|
const sendNotification = ({ firebaseMessaging, idCliente, title, body, screen = common_1.NOTIFICATION_SCREEN_TYPES.HOME, screenParams = {}, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
const devices = yield (0, index_1.query)('SELECT [SUBSCRIPTION], [TYPE] FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ?', [idCliente]);
|
|
17
|
+
const [{ id: idNotification }] = yield (0, index_1.query)('INSERT INTO "CLIENTE NOTIFICACION" ("ID CLIENTE", "TIMESTAMP", "TITLE", "BODY", "PARAMS") VALUES (?, NOW(), ?, ?, ?) RETURNING "ID"', [
|
|
18
|
+
idCliente,
|
|
19
|
+
title !== null && title !== void 0 ? title : '',
|
|
20
|
+
body,
|
|
21
|
+
JSON.stringify({
|
|
22
|
+
screen,
|
|
23
|
+
screenParams,
|
|
24
|
+
}),
|
|
25
|
+
]);
|
|
17
26
|
const screenParamsString = JSON.stringify(screenParams);
|
|
18
27
|
for (const device of devices) {
|
|
19
28
|
notificationWEB(firebaseMessaging, {
|
|
20
29
|
title,
|
|
21
30
|
body,
|
|
31
|
+
idNotification,
|
|
22
32
|
screen,
|
|
23
33
|
screenParams: screenParamsString,
|
|
24
34
|
}, device.subscription);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAiBpD,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAiBpD,CAAC;AA4QF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY,kBA8Bd,CAAC;AA4BF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|