powr-sdk-api 4.7.0 → 4.7.1
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 +8 -7
- package/package.json +1 -1
package/dist/routes/chat.js
CHANGED
|
@@ -17,9 +17,9 @@ router.get('/conversations', async (req, res) => {
|
|
|
17
17
|
const projectId = req.projectId;
|
|
18
18
|
console.log('Current user ID:', userId, 'Access:', userAccess, 'Project:', projectId);
|
|
19
19
|
const db = await getDb();
|
|
20
|
+
// Show all conversations user is in (1:1 DMs and groups, any project)
|
|
20
21
|
const conversations = await db.collection('conversations').find({
|
|
21
|
-
participants: userId
|
|
22
|
-
projectId: projectId
|
|
22
|
+
participants: userId
|
|
23
23
|
}).toArray();
|
|
24
24
|
|
|
25
25
|
// Build response for each conversation
|
|
@@ -97,11 +97,13 @@ router.get('/conversations/:conversationId/messages', async (req, res) => {
|
|
|
97
97
|
// Verify user is part of conversation
|
|
98
98
|
const conversation = await db.collection('conversations').findOne({
|
|
99
99
|
_id: new ObjectId(conversationId),
|
|
100
|
-
participants: userId
|
|
101
|
-
projectId: projectId
|
|
100
|
+
participants: userId
|
|
102
101
|
});
|
|
103
102
|
if (!conversation) {
|
|
104
|
-
return res.
|
|
103
|
+
return res.status(404).json({
|
|
104
|
+
success: false,
|
|
105
|
+
message: 'Conversation not found'
|
|
106
|
+
});
|
|
105
107
|
}
|
|
106
108
|
const messages = await db.collection('messages').find({
|
|
107
109
|
conversationId: conversationId
|
|
@@ -164,8 +166,7 @@ router.post('/conversations/:conversationId/messages', async (req, res) => {
|
|
|
164
166
|
// Verify user is part of conversation
|
|
165
167
|
const conversation = await db.collection('conversations').findOne({
|
|
166
168
|
_id: new ObjectId(conversationId),
|
|
167
|
-
participants: userId
|
|
168
|
-
projectId: projectId
|
|
169
|
+
participants: userId
|
|
169
170
|
});
|
|
170
171
|
if (!conversation) {
|
|
171
172
|
return res.status(404).json({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powr-sdk-api",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "Shared API core library for PowrStack projects. Zero dependencies - works with Express, Next.js API routes, and other frameworks. All features are optional and install only what you need.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|