@runnerpro/backend 1.10.12 → 1.10.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.
|
@@ -93,22 +93,20 @@ const getConversation = (req, res, { query, isClient }) => __awaiter(void 0, voi
|
|
|
93
93
|
});
|
|
94
94
|
// TODO: Tener en cuenta para el flujo de sugerir mensaje
|
|
95
95
|
const deleteConversationMessage = (req, res, { query, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
96
|
-
console.log('deleteConversationMessage - req.params:', req.params);
|
|
97
|
-
console.log('deleteConversationMessage - isClient:', isClient);
|
|
98
|
-
console.log('deleteConversationMessage - req.session:', req.session);
|
|
99
96
|
const { id } = req.params;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
const [message] = yield query('SELECT [ID] FROM [CHAT MESSAGE] WHERE [ID] = ? AND (? = FALSE OR [ID CLIENTE] = ?)', [
|
|
98
|
+
id,
|
|
99
|
+
isClient,
|
|
100
|
+
req.session.userid,
|
|
101
|
+
]);
|
|
102
|
+
if (!message)
|
|
103
|
+
return res.status(404).send('Not found');
|
|
104
|
+
if (isClient) {
|
|
105
|
+
yield query('UPDATE [CHAT MESSAGE] SET [ELIMINADO] = TRUE WHERE [ID] = ?', [id]);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
yield query('DELETE FROM [CHAT MESSAGE] WHERE [ID] = ?', [id]);
|
|
109
|
+
}
|
|
112
110
|
res.send({ status: 'ok' });
|
|
113
111
|
});
|
|
114
112
|
// TODO: Sugerencias de texto
|
|
@@ -190,8 +188,8 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, query, isC
|
|
|
190
188
|
isClient,
|
|
191
189
|
query,
|
|
192
190
|
});
|
|
193
|
-
yield query('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [REPLY MESSAGE ID], [TYPE]) VALUES (?, ?, ?, ?, ?, ?, ?)', [isClient ? userid : idCliente, userid, textSpanish, textPreferredLanguage, preferredLanguage, replyMessageId, 1]);
|
|
194
|
-
res.send({
|
|
191
|
+
const [message] = yield query('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [REPLY MESSAGE ID], [TYPE]) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING [ID]', [isClient ? userid : idCliente, userid, textSpanish, textPreferredLanguage, preferredLanguage, replyMessageId, 1]);
|
|
192
|
+
res.send({ idMessage: message.id });
|
|
195
193
|
if (!isClient) {
|
|
196
194
|
sendNotification({
|
|
197
195
|
firebaseMessaging,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAoBpD,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAoBpD,CAAC;AAgRF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|