powr-sdk-api 3.0.10 → 3.1.0
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.
- package/dist/routes/chat.js +3 -3
- package/dist/routes/forms.js +3 -7
- package/package.json +1 -1
package/dist/routes/chat.js
CHANGED
|
@@ -14,7 +14,7 @@ router.get('/conversations', async (req, res) => {
|
|
|
14
14
|
try {
|
|
15
15
|
const userId = req.user.powrId;
|
|
16
16
|
const userAccess = req.user.access;
|
|
17
|
-
const projectId = req.
|
|
17
|
+
const projectId = req.projectId;
|
|
18
18
|
console.log('Current user ID:', userId, 'Access:', userAccess, 'Project:', projectId);
|
|
19
19
|
const db = await getDb();
|
|
20
20
|
const conversations = await db.collection('conversations').find({
|
|
@@ -84,7 +84,7 @@ router.get('/conversations/:conversationId/messages', async (req, res) => {
|
|
|
84
84
|
conversationId
|
|
85
85
|
} = req.params;
|
|
86
86
|
const userId = req.user.powrId;
|
|
87
|
-
const projectId = req.
|
|
87
|
+
const projectId = req.projectId;
|
|
88
88
|
const db = await getDb();
|
|
89
89
|
|
|
90
90
|
// Verify user is part of conversation
|
|
@@ -310,7 +310,7 @@ router.get('/users', async (req, res) => {
|
|
|
310
310
|
try {
|
|
311
311
|
const userId = req.user.powrId;
|
|
312
312
|
const userAccess = req.user.access;
|
|
313
|
-
const projectId = req.
|
|
313
|
+
const projectId = req.projectId;
|
|
314
314
|
console.log('Current user access level:', userAccess, 'Project:', projectId);
|
|
315
315
|
const db = await getDb();
|
|
316
316
|
|
package/dist/routes/forms.js
CHANGED
|
@@ -140,19 +140,15 @@ router.get('/getCount/:formName', async (req, res) => {
|
|
|
140
140
|
const {
|
|
141
141
|
formName
|
|
142
142
|
} = req.params;
|
|
143
|
-
const
|
|
144
|
-
projectId
|
|
145
|
-
} = req.query;
|
|
143
|
+
const projectId = req.projectId;
|
|
146
144
|
const db = await getDb();
|
|
147
145
|
const studentsFormCollection = db.collection('studentsForm');
|
|
148
146
|
|
|
149
147
|
// Build query object
|
|
150
148
|
let query = {
|
|
151
|
-
formName
|
|
149
|
+
formName,
|
|
150
|
+
projectId
|
|
152
151
|
};
|
|
153
|
-
if (projectId) {
|
|
154
|
-
query.projectId = projectId;
|
|
155
|
-
}
|
|
156
152
|
const submissions = await studentsFormCollection.find(query).toArray();
|
|
157
153
|
res.status(200).json({
|
|
158
154
|
success: true,
|