@runnerpro/backend 1.5.12 → 1.5.14
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.
|
@@ -11,13 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendNotification = void 0;
|
|
13
13
|
const index_1 = require("../db/index");
|
|
14
|
-
const sendMail_1 = require("../sendMail");
|
|
15
14
|
const sendNotification = ({ firebaseMessaging, idCliente, title, body }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
15
|
const devices = yield (0, index_1.query)('SELECT [SUBSCRIPTION], [TYPE] FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ?', [idCliente]);
|
|
17
16
|
for (const device of devices) {
|
|
18
17
|
notificationWEB(firebaseMessaging, {
|
|
19
18
|
title,
|
|
20
|
-
body
|
|
19
|
+
body,
|
|
21
20
|
}, device.subscription);
|
|
22
21
|
}
|
|
23
22
|
});
|
|
@@ -31,14 +30,6 @@ function notificationWEB(firebaseMessaging, msg, token) {
|
|
|
31
30
|
token,
|
|
32
31
|
notification: msg,
|
|
33
32
|
data: msg,
|
|
34
|
-
})
|
|
35
|
-
.then((response) => {
|
|
36
|
-
(0, sendMail_1.sendMail)({
|
|
37
|
-
to: ['david.jimenez@runnerpro.app'],
|
|
38
|
-
subject: 'Notificación APN enviada',
|
|
39
|
-
title: 'Notificación APN enviada ' + token,
|
|
40
|
-
body: JSON.stringify(response),
|
|
41
|
-
});
|
|
42
33
|
})
|
|
43
34
|
.catch((error) => {
|
|
44
35
|
if (error.errorInfo.code === 'messaging/registration-token-not-registered') {
|
|
@@ -47,12 +38,6 @@ function notificationWEB(firebaseMessaging, msg, token) {
|
|
|
47
38
|
// [idCliente, subscription]
|
|
48
39
|
// );
|
|
49
40
|
}
|
|
50
|
-
(0, sendMail_1.sendMail)({
|
|
51
|
-
to: ['david.jimenez@runnerpro.app'],
|
|
52
|
-
subject: 'Error enviando notificación APN',
|
|
53
|
-
title: 'Error enviando notificación APN ' + token,
|
|
54
|
-
body: JSON.stringify(error),
|
|
55
|
-
});
|
|
56
41
|
});
|
|
57
42
|
});
|
|
58
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAGA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,QAAA,MAAM,gBAAgB,kDAAyD,YAAY,kBAa1F,CAAC;AAqBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runnerpro/backend",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.14",
|
|
4
4
|
"description": "A collection of common backend functions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/cjs/index.js"
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@napi-rs/canvas": "^0.1.53",
|
|
56
|
-
"@parse/node-apn": "6.0.1",
|
|
57
56
|
"@runnerpro/common": "^1.5.1",
|
|
58
57
|
"axios": "^1.6.7",
|
|
59
58
|
"image-size": "^1.0.2",
|