@peopl-health/nexus 3.15.1 → 3.15.3

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.
@@ -66,6 +66,27 @@ const reportBugController = async (req, res) => {
66
66
  }
67
67
  };
68
68
 
69
+ const updateBugController = async (req, res) => {
70
+ try {
71
+ const { recordId } = req.params;
72
+ if (!recordId) return res.status(400).json({ success: false, error: 'recordId is required' });
73
+
74
+ const { fields } = req.body || {};
75
+ if (!fields || Object.keys(fields).length === 0) {
76
+ return res.status(400).json({ success: false, error: 'No fields provided for update' });
77
+ }
78
+
79
+ const Bug = getBug();
80
+ const updatedBug = await Bug.findOneAndUpdate({ recordId }, fields, { new: true });
81
+ if (!updatedBug) return res.status(404).json({ success: false, error: 'Bug not found' });
82
+
83
+ res.status(200).json({ success: true, bug: updatedBug });
84
+ } catch (error) {
85
+ logger.error('Error updating bug report:', { error: error.message, recordId: req.params?.recordId });
86
+ res.status(500).json({ success: false, error: error.message });
87
+ }
88
+ };
89
+
69
90
  const getBugByWhatsappIdController = async (req, res) => {
70
91
  try {
71
92
  const { whatsapp_id } = req.params;
@@ -113,4 +134,4 @@ const getBugByWhatsappIdController = async (req, res) => {
113
134
  }
114
135
  };
115
136
 
116
- module.exports = { reportBugController, getBugByWhatsappIdController };
137
+ module.exports = { reportBugController, getBugByWhatsappIdController, updateBugController };
@@ -11,7 +11,20 @@ const bugSchema = new mongoose.Schema({
11
11
  description: { type: String, required: true },
12
12
  severity: { type: String, required: true, enum: VALID_SEVERITIES },
13
13
  messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }],
14
- server: { type: String }
14
+ server: { type: String, default: null },
15
+ bugType: { type: String, default: null },
16
+ status: { type: String, default: 'Open' },
17
+ repository: { type: String, default: null },
18
+ issue: { type: String, default: null },
19
+ assignees: [{ type: String, default: null }],
20
+ pullRequests: [{ type: String, default: null }],
21
+ resolution: { type: String, default: null },
22
+ inmediatePatch: { type: String, default: null },
23
+ recordId: { type: String, default: null },
24
+ project: {
25
+ projectId: { type: String, default: null },
26
+ responsible: { type: String, default: null }
27
+ }
15
28
  }, { timestamps: true });
16
29
 
17
30
  const getBug = () => {
@@ -27,6 +27,7 @@ const conversationRouteDefinitions = {
27
27
  'POST /:phoneNumber/read': 'markMessagesAsReadController',
28
28
  'POST /case-documentation': 'caseDocumentationController',
29
29
  'POST /bug': 'reportBugController',
30
+ 'PATCH /bug/:recordId': 'updateBugController',
30
31
  'POST /interaction': 'addInteractionController',
31
32
  'PUT /review/all': 'updateAllReviewStatusController',
32
33
  'PUT /review/:code': 'updateReviewStatusController'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "3.15.1",
3
+ "version": "3.15.3",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",