@runnerpro/backend 1.8.3 → 1.8.5

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.
@@ -29,7 +29,6 @@ const path_1 = __importDefault(require("path"));
29
29
  const util_1 = require("util");
30
30
  const jimp_1 = __importDefault(require("jimp"));
31
31
  const exifr_1 = __importDefault(require("exifr"));
32
- const axios_1 = __importDefault(require("axios"));
33
32
  const index_1 = require("../../index");
34
33
  const common_1 = require("@runnerpro/common");
35
34
  const index_2 = require("../../locale/index");
@@ -44,7 +43,6 @@ const conversationRoute = (_a) => {
44
43
  },
45
44
  });
46
45
  router.get('/conversation', (req, res, next) => getConversation(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
47
- router.get('/conversation/suggestion', (req, res, next) => getConversationSuggestion(req, res).catch((error) => (0, index_1.err)(req, res, error, next)));
48
46
  router.get('/conversation/image/:id', (req, res, next) => getConversationImage(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
49
47
  router.get('/conversation/file/:id', (req, res, next) => getConversationFile(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
50
48
  router.post('/conversation/send', (req, res, next) => sendMessage(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
@@ -139,27 +137,6 @@ const getChatFile = ({ query, bucket, id, isClient, userid }) => __awaiter(void
139
137
  return null;
140
138
  }
141
139
  });
142
- const getConversationSuggestion = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
143
- let result;
144
- try {
145
- result = yield axios_1.default
146
- .post(`${process.env.BACKEND_IA_URL}/api/chat/suggestion`, { userId: req.query.user }, {
147
- headers: {
148
- 'ngrok-skip-browser-warning': true, // working with ngrok
149
- 'Content-Type': 'application/json',
150
- Authorization: `Bearer ${process.env.IA_ACCESS_TOKEN}`,
151
- },
152
- })
153
- .then((response) => response.data);
154
- }
155
- catch (e) {
156
- (0, index_1.err)(null, null, e, null);
157
- result = { error: 'Ha habido un error con el servidor' };
158
- }
159
- finally {
160
- res.send(result);
161
- }
162
- });
163
140
  const sendMessage = (req, res, { sendNotification, firebaseMessaging, query, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
164
141
  const { text, replyMessageId } = req.body;
165
142
  const { userid } = req.session;
@@ -32,8 +32,11 @@ function notificationWEB(firebaseMessaging, msg, token) {
32
32
  firebaseMessaging
33
33
  .send({
34
34
  token,
35
- notification: msg,
36
- data: Object.assign(Object.assign({}, msg), { screen: msg.screen, screenParams: msg.screenParams }),
35
+ notification: {
36
+ title: msg.title,
37
+ body: msg.body,
38
+ },
39
+ data: msg,
37
40
  })
38
41
  .catch((error) => {
39
42
  if (error.errorInfo.code === 'messaging/registration-token-not-registered') {
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAkBpD,CAAC;AAyRF,OAAO,EAAE,iBAAiB,EAAE,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;AAiQF,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,kBAgBd,CAAC;AAyBF,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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"