Skip to content

Mili made #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
da41f03
Ignore .env folder
boobeh123 Sep 2, 2022
8bb956c
Due Date Changes
jhausler46 Sep 4, 2022
3c45864
Due Date changes part 2
jhausler46 Sep 4, 2022
79f0091
Add reset & normalize to public/css directory
boobeh123 Sep 4, 2022
c356dad
Link stylesheets & add fontawesome script src
boobeh123 Sep 4, 2022
5823302
Add reset & normalize to public/css
boobeh123 Sep 4, 2022
57403c1
Link stylesheets, Add anchor & apply classes to anchors, Add fontawes…
boobeh123 Sep 4, 2022
d261a87
Add styles & media queries to index.ejs
boobeh123 Sep 4, 2022
df9eed9
Merge branch 'boobeh' of https://github.com/neverarockstar/todo-mvc-a…
boobeh123 Sep 4, 2022
4ac3f1f
Merge pull request #2 from neverarockstar/boobeh
boobeh123 Sep 4, 2022
54cb57b
Ignore config/.env
boobeh123 Sep 4, 2022
bb93529
Link stylesheets, Add fieldset & labels to login form, Add fontawesom…
boobeh123 Sep 4, 2022
5b8be76
Apply styles to login & add media queries to login.ejs
boobeh123 Sep 4, 2022
82e6032
Removed env file
jhausler46 Sep 5, 2022
cb2c8b2
Removed Env file 2
jhausler46 Sep 5, 2022
d76880a
Merge branch 'main' into DueDate
boobeh123 Sep 5, 2022
965f72a
Merge pull request #1 from neverarockstar/DueDate
boobeh123 Sep 6, 2022
ad19e32
Merge pull request #3 from neverarockstar/boobeh
boobeh123 Sep 6, 2022
594e207
Remove config/.env from ignore (re-add demo ENV file)
boobeh123 Sep 6, 2022
e073b98
Merge pull request #4 from neverarockstar/boobeh
boobeh123 Sep 6, 2022
0fe2e45
Add demo .env file
boobeh123 Sep 6, 2022
b94e4cd
Ignore config/.env
boobeh123 Sep 6, 2022
8f3c13b
Merge pull request #5 from neverarockstar/boobeh
boobeh123 Sep 6, 2022
af7c993
updated css
MiliMade Sep 6, 2022
50349ed
Made changes to css of index, login, signup
MiliMade Sep 6, 2022
35ffccd
Added css for all of the views
MiliMade Sep 10, 2022
794ed87
Delete .env
MiliMade Sep 10, 2022
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
@@ -1,2 +1,3 @@
node_modules
.vscode/*
.vscode/*
config/.env
2 changes: 0 additions & 2 deletions config/.env

This file was deleted.

4 changes: 2 additions & 2 deletions controllers/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const Todo = require('../models/Todo')

module.exports = {
getTodos: async (req,res)=>{
console.log(req.user)
console.log(req.user)// gets the todos of the just the user logged in. The .user property comes from passport
try{
const todoItems = await Todo.find({userId:req.user.id})
const todoItems = await Todo.find({userId:req.user.id})//This goes to the database and finds the todos that matches the user id of the logged in user. Todo is capitalized because thats the name of the model file.
const itemsLeft = await Todo.countDocuments({userId:req.user.id,completed: false})
res.render('todos.ejs', {todos: todoItems, left: itemsLeft, user: req.user})
}catch(err){
Expand Down
4 changes: 2 additions & 2 deletions middleware/auth.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
ensureAuth: function (req, res, next) {
if (req.isAuthenticated()) {
if (req.isAuthenticated()) { //checks to see if there was a logged in user. .isAuthenticated comes from passport.
return next()
} else {
res.redirect('/')
res.redirect('/')// if the user is not logged in, return user to main page.
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions models/Todo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const mongoose = require('mongoose')
const mongoose = require('mongoose')// Talks to the database.

const TodoSchema = new mongoose.Schema({
todo: {
Expand All @@ -12,7 +12,11 @@ const TodoSchema = new mongoose.Schema({
userId: {
type: String,
required: true
},
dueDate: {
type: String,
required: true
}
})
})// this model is used to talk to the database

module.exports = mongoose.model('Todo', TodoSchema)
module.exports = mongoose.model('Todo', TodoSchema)//used in the todos controller.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading