Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ results
npm-debug.log
node_modules
database.js
.env
.env
profileEJSBU.txt
10 changes: 8 additions & 2 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ const moodActions = {
const user = req.user || null;

const moodCollection = await Mood.find({ userId: req.user._id });

const latestMood = await Mood.findOne().sort({ timestamp: 1 }).exec();
console.log(`This is the latest log: ${latestMood}`)
console.log(`This is the latest mood: ${latestMood.mood}`)
const backgroundColor = latestMood.length > 0 ? latestMood.mood : 'neutral'
console.log(`This is the background color: ${backgroundColor}`)

res.render('profile', { user, moodCollection });
res.render('profile', { user, moodCollection, backgroundColor });
} catch (err) {
console.log('Error fetching moods:', err);
res.status(500).send('Internal Server Error');
Expand Down Expand Up @@ -106,7 +112,7 @@ app.post('/submitMood', (req, res) => {
});


// Edit mood
// Edit mood

app.put('/mood/:id', async (req, res) => {
const moodId = req.params.id;
Expand Down
2 changes: 1 addition & 1 deletion config/database.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// config/database.js
module.exports = {
'url' : 'mongodb://mongo:xUrCxmUvhUJZtSPhoDOPSmOLCxqczxsS@mongodb.railway.internal:27017',
'url' : 'mongodb+srv://branic1578:eZdPtF9CXVrfL2gF@cluster0.rss8y.mongodb.net/',
'dbName': 'mood-tracker'
};
28 changes: 0 additions & 28 deletions node_modules/has-symbols/test/shams/core-js.js

This file was deleted.

28 changes: 0 additions & 28 deletions node_modules/has-symbols/test/shams/get-own-property-symbols.js

This file was deleted.

168 changes: 0 additions & 168 deletions node_modules/oauth/examples/express-gdata/server.js

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions node_modules/oauth/examples/express-gdata/views/layout.ejs

This file was deleted.

15 changes: 0 additions & 15 deletions node_modules/object-inspect/test/browser/dom.js

This file was deleted.

45 changes: 0 additions & 45 deletions node_modules/passport-oauth1/lib/errors/internaloautherror.js

This file was deleted.

Loading