@peopl-health/nexus 4.2.12 → 4.2.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.
|
@@ -16,7 +16,7 @@ const INTERNAL_ORIGINS = new Set(['system', 'instruction']);
|
|
|
16
16
|
|
|
17
17
|
const messageSchema = new mongoose.Schema({
|
|
18
18
|
raw: { type: Object, default: null },
|
|
19
|
-
body: { type: String,
|
|
19
|
+
body: { type: String, default: '' },
|
|
20
20
|
numero: { type: String, required: true },
|
|
21
21
|
nombre_whatsapp: { type: String, default: null },
|
|
22
22
|
timestamp: { type: String, required: true, default: Date.now },
|
|
@@ -79,10 +79,11 @@ class MongoStorage {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
_emitMessageNew(doc, from, frontendId, status = null) {
|
|
82
|
-
|
|
82
|
+
const fromValue = from || doc?.numero;
|
|
83
|
+
if (!fromValue || !doc?._id) return;
|
|
83
84
|
safeEmit(getStatusEventBus(), 'message:new', createEvent('message:new', {
|
|
84
85
|
messageId: String(doc._id),
|
|
85
|
-
from,
|
|
86
|
+
from: fromValue,
|
|
86
87
|
code: doc.numero,
|
|
87
88
|
name: doc.nombre_whatsapp,
|
|
88
89
|
origin: doc.origin,
|