Skip to content

Commit 2bcbfd7

Browse files
committed
Update users controller, model, and lib
1 parent f85562d commit 2bcbfd7

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/controllers/Users.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export default {
2424
},
2525

2626
create(req, res) {
27-
// TODO: Send temporary password to the new user
28-
// after the user record has beend created
29-
3027
Users.create({
3128
res,
3229
body: req.body

src/lib/Users.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ export function create(options) {
105105
updatedAt: new Date()
106106
})
107107
.then(User => {
108-
// TODO: Create promises for paths creation and
109-
// sending temporary password to the new user
108+
// TODO: Send temporary password to the new user
109+
// after the user's path has been created
110110

111111
return Paths.create({
112112
res,
@@ -195,8 +195,7 @@ export function destroy(options) {
195195
}
196196

197197
function jsonUsers(Users) {
198-
return Users
199-
.map(User => {
198+
return _.map(Users, User => {
200199
return jsonUser(User)
201200
})
202201
}

src/models/User.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export default (sequelize, DataTypes) => {
2525
return bcrypt.compareSync(password, this.password)
2626
}
2727

28+
User.prototype.fullName = function() {
29+
return [this.firstName, this.lastName].join(' ')
30+
}
31+
2832
User.associate = (models) => {
2933
User.hasOne(models.Path, {
3034
as: 'Paths',

0 commit comments

Comments
 (0)