Skip to content

Commit

Permalink
user model change
Browse files Browse the repository at this point in the history
  • Loading branch information
Myau5x committed Feb 20, 2021
1 parent 2e8b192 commit f27a856
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const db = require("../models");
module.exports = {
createUser: function(req, res) {
db.User
.create({email: req.body.email})
.create({email: req.body.email, nickName: req.body.nickName})
.then(dbModel => res.json(dbModel))
.catch(err => res.status(422).json(err));
},
Expand Down
3 changes: 2 additions & 1 deletion models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const Schema = mongoose.Schema;
const userSchema = new Schema({
email: { type: String, required: true },
balance: {type: Number, default: 10000.00},
investingStartDay: { type: Date, default: Date.now }
investingStartDay: { type: Date, default: Date.now },
nickName: String
});

const User = mongoose.model("User", userSchema);
Expand Down

0 comments on commit f27a856

Please sign in to comment.