Skip to content

Commit

Permalink
v5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
CS17B011 committed Jan 30, 2020
1 parent a160bf5 commit ff549b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 2 additions & 0 deletions routes/c3.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ c3Router.post('/', (req, res) => {
})

// UPDATE
/*
c3Router.put('/:id', (req, res) => {
C3.findOneAndUpdate({_id : req.params.id}, req.body, {runValidators : true}, (err, response) => {
if(err) {
Expand All @@ -42,6 +43,7 @@ c3Router.put('/:id', (req, res) => {
}});
})
})
*/
module.exports = c3Router;

/* {
Expand Down
13 changes: 5 additions & 8 deletions routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@ const userRouter = express.Router();
const User = require('../models/C3User');
const loggedin = require("../services/middleware");
// READ
userRouter.get('/',(req, res) => {
userRouter.get('/',loggedin,(req, res) => {
//id = String(id);

/*
const user = req.session.passport.user;
var nameid;
if (user.googleid)
nameid = "g_" + user._id;
else
nameid = "l_" + user._id;
*/

var nameid = "l_1";
//var nameid = "l_1";

User.findOne({"name_id":nameid}, (err, response) => {
if (err) res.status(500).json({
Expand All @@ -30,6 +28,7 @@ userRouter.get('/',(req, res) => {

// POST

/*
userRouter.post('/', (req, res) => {
const user = new User(req.body);
user.save((err, response) => {
Expand All @@ -40,22 +39,20 @@ userRouter.post('/', (req, res) => {
message : "added"
})
})
})
})*/

// UPDATE

userRouter.put('/', loggedin, (req, res) => {

/*
const user = req.session.passport.user;
var nameid;
if (user.googleid)
nameid = "g_" + user._id;
else
nameid = "l_" + user._id;
*/

var nameid = "l_1";
//var nameid = "l_1";

User.updateOne({"name_id":nameid}, req.body, {runValidators : true}, (err, response) => {
if(err) {
Expand Down

0 comments on commit ff549b7

Please sign in to comment.