Skip to content

Commit 61fa34b

Browse files
committed
Update stats acc to db changes
1 parent e72db7d commit 61fa34b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ app.get('/stats', async (req, res) => {
6363
try{
6464
const users = await manageUsers({}, 'read');
6565
const products = await manageProducts({}, 'read');
66-
res.status(200).send(JSON.stringify({users: users?.result?.length, products: products?.result?.length}))
66+
let productCount = 0;
67+
products.result.map((p) => (p += item.users.length));
68+
res.status(200).send(JSON.stringify({users: users?.result?.length, products: productCount }))
6769
}catch(e){
6870

6971
}

0 commit comments

Comments
 (0)