@runnerpro/backend 1.8.6 → 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.
@@ -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);
@@ -3,6 +3,7 @@ interface Notification {
3
3
  idCliente: number;
4
4
  title?: string;
5
5
  body: string;
6
+ idNotification?: number;
6
7
  screen?: string;
7
8
  screenParams?: any;
8
9
  }
@@ -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,kBAgBd,CAAC;AAwBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"