Fixed issues with category routes and worked on post routes

This commit is contained in:
2023-02-02 15:26:47 -05:00
parent 555fc37047
commit 24e2326dc4
11 changed files with 513 additions and 53 deletions

View File

@@ -4,12 +4,17 @@ const bcrypt = require('bcrypt');
// checkSession(userId, sessionId) checks if the sessionId is valid for the user
const checkSession = (userId, sessionId, f) => {
let success = false;
Session.find({ userId: userId, sessionId: sessionId }, (err, res) => {
if (res && res.type == 0) {
f(true);
return;
}
f(false);
res.forEach(element => {
if (element.type == 0 && !success) {
success = true;
f(true);
return;
}
})
if (!success)
f(false);
});
}

0
utils/viewcount.js Normal file
View File