powr-sdk-api 3.2.0 → 3.2.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/feeds.js +14 -2
- package/package.json +1 -1
package/dist/routes/feeds.js
CHANGED
|
@@ -109,6 +109,12 @@ router.get('/', async (req, res) => {
|
|
|
109
109
|
}
|
|
110
110
|
const db = await getDb();
|
|
111
111
|
|
|
112
|
+
// Debug: Check if posts exist
|
|
113
|
+
const debugPosts = await db.collection('feeds').find(query).toArray();
|
|
114
|
+
console.log('Debug - Found posts:', debugPosts.length);
|
|
115
|
+
console.log('Debug - Query:', query);
|
|
116
|
+
console.log('Debug - ProjectId:', projectId);
|
|
117
|
+
|
|
112
118
|
// Get posts with author info
|
|
113
119
|
const posts = await db.collection('feeds').aggregate([{
|
|
114
120
|
$match: query
|
|
@@ -128,7 +134,10 @@ router.get('/', async (req, res) => {
|
|
|
128
134
|
as: 'author'
|
|
129
135
|
}
|
|
130
136
|
}, {
|
|
131
|
-
$unwind:
|
|
137
|
+
$unwind: {
|
|
138
|
+
path: '$author',
|
|
139
|
+
preserveNullAndEmptyArrays: true
|
|
140
|
+
}
|
|
132
141
|
}, {
|
|
133
142
|
$project: {
|
|
134
143
|
'author.password': 0,
|
|
@@ -176,7 +185,10 @@ router.get('/:id', async (req, res) => {
|
|
|
176
185
|
as: 'author'
|
|
177
186
|
}
|
|
178
187
|
}, {
|
|
179
|
-
$unwind:
|
|
188
|
+
$unwind: {
|
|
189
|
+
path: '$author',
|
|
190
|
+
preserveNullAndEmptyArrays: true
|
|
191
|
+
}
|
|
180
192
|
}, {
|
|
181
193
|
$project: {
|
|
182
194
|
'author.password': 0,
|