@peopl-health/nexus 5.57.0-dev.9678 → 5.57.0-dev.9698
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,7 +1,7 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
2
|
|
|
3
3
|
const { logger } = require('../utils/logger');
|
|
4
|
-
const { isAllowedUrl, redactDirectIdentifiers } = require('../utils/sanitizerUtils');
|
|
4
|
+
const { WHATSAPP_PATIENT_CODE, isAllowedUrl, redactDirectIdentifiers } = require('../utils/sanitizerUtils');
|
|
5
5
|
|
|
6
6
|
const { getPatientInformation, updatePatientInformation, logPatientChange } = require('../services/patientService');
|
|
7
7
|
const { getTriageHistory } = require('../services/triageHistoryService');
|
|
@@ -79,6 +79,7 @@ const reviewPatientCarePlanCardController = async (req, res) => {
|
|
|
79
79
|
const recommendationId = String(req.params.cardId || '').trim();
|
|
80
80
|
try {
|
|
81
81
|
if (!code) return res.status(400).json({ success: false, error: 'WhatsApp ID is required' });
|
|
82
|
+
if (!WHATSAPP_PATIENT_CODE.test(code)) return res.status(400).json({ success: false, error: 'A whatsapp:+<digits> patient code is required' });
|
|
82
83
|
if (!recommendationId) return res.status(400).json({ success: false, error: 'cardId is required' });
|
|
83
84
|
|
|
84
85
|
const { verdict, note = null, correctedText = null, reviewedBy, eventKey = null } = req.body || {};
|
|
@@ -26,6 +26,7 @@ function maskSensitiveValue(value) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const PATIENT_CODE = /^(?:whatsapp:)?\+\d{10,15}$/;
|
|
29
|
+
const WHATSAPP_PATIENT_CODE = /^whatsapp:\+\d{10,15}$/;
|
|
29
30
|
// Match the complete contiguous digit run. Although valid E.164 numbers stop at
|
|
30
31
|
// 15 digits, malformed or concatenated identifiers must not leave a visible
|
|
31
32
|
// suffix in logs.
|
|
@@ -150,6 +151,7 @@ function redactDirectIdentifiers(value) {
|
|
|
150
151
|
|
|
151
152
|
module.exports = {
|
|
152
153
|
PATIENT_CODE,
|
|
154
|
+
WHATSAPP_PATIENT_CODE,
|
|
153
155
|
decodeUnicodeEscapes,
|
|
154
156
|
decodeUnicodeEscapesDeep,
|
|
155
157
|
collectStringsDeep,
|