@peopl-health/nexus 3.5.14 → 3.5.15
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { Historial_Clinico_ID } = require('../config/airtableConfig');
|
|
1
|
+
const { Historial_Clinico_ID, Symptoms_ID } = require('../config/airtableConfig');
|
|
2
2
|
|
|
3
3
|
const { logger } = require('../utils/logger');
|
|
4
4
|
const { parseDate } = require('../utils/dateUtils');
|
|
@@ -27,11 +27,18 @@ const toMap = (arr, keyFn, valFn) => arr.reduce((m, item) => {
|
|
|
27
27
|
}, {});
|
|
28
28
|
|
|
29
29
|
const fetchConversationData = async (filter, skip, limit) => {
|
|
30
|
+
let triageIds = [];
|
|
31
|
+
if (filter === 'triage-last-month') {
|
|
32
|
+
const triageRecords = await getRecordByFilter(Symptoms_ID, 'estado_general', 'TRUE()', 'complete_triage_last_month', ['whatsapp_id']);
|
|
33
|
+
triageIds = (triageRecords || []).map(r => r.whatsapp_id).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
const filterMap = {
|
|
31
37
|
unread: { ...BASE_MATCH, ...UNREAD_MATCH },
|
|
32
38
|
recent: { ...BASE_MATCH, createdAt: { $gt: new Date(Date.now() - 86400000) } },
|
|
33
39
|
'no-response': BASE_MATCH,
|
|
34
40
|
'pending-review': BASE_MATCH,
|
|
41
|
+
'triage-last-month': { ...BASE_MATCH, numero: { $in: triageIds } },
|
|
35
42
|
all: BASE_MATCH
|
|
36
43
|
};
|
|
37
44
|
const filterConditions = filterMap[filter] || BASE_MATCH;
|