Skip to content
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

Feedback implementation #8

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open

Feedback implementation #8

wants to merge 33 commits into from

Conversation

bumsyalao
Copy link
Owner

What does this PR do?

  • Implement feed back given

- Added HsDocs to code
- Implemented confirm password
- write more test cases
- remove console.logs
- return errors correctly
- added JsDocs
- implement airbnb style guide
- Fix eslint errors

[Fixes #1]
- write client test for components
- write client test for reducers
- write test for all actions
- fix bug with jest and images
- fix more eslint errors
- added favicon to app
- changed app port to 6116
- rebundle webpack
- git ignore dist
- Add FAQ, limitations and MIT license to readme
- Create an email address for postit application
- Change all parameters to camelCase
- Return responses as object
- Change group card layout to take two cards
- Add check to not allow users view message of groups they don't belong to
- Add page not found to all incorrect routes
- Add posiinstall script
- Add babel-loader to dependencies
- Upgrade node and npm version
- Install babel-oreset-env
- gitignore dist
- change build script
- update dependency
- Fix to remove warnings in console.
- Fix Serverside test
- format email notification
@bumsyalao bumsyalao temporarily deployed to postit-now November 17, 2017 01:50 Inactive
@bumsyalao bumsyalao force-pushed the feedback-implementation branch 3 times, most recently from 8c87991 to 34ac981 Compare November 17, 2017 09:45
.post('/api/v1/user/signup')
.send({ chopper
})
.end((err, res) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

it('should get token for all tests', (done) => {
api
.post('/api/v1/user/signup')
.send({ chopper

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

describe('ROUTES', () => {
after((done) => {
models.Users.destroy({ where: { username: 'candy' } }).then(() => done());
});

it('should get token for all tests', (done) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

@@ -32,10 +33,26 @@ const nullPassword = {
password: null
};

let token = ''; // eslint-disable-line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

import app from '../../app';
import models from '../../server/models';
import app from '../../../app';
import models from '../../../server/models';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

done();
});
});
it('should not create another group with same groupName', (done) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.set({ jwt: validToken })
.send(group)
.expect(200)
.end((err, res) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

});

describe('POST: (/api/v1/group) - Create', () => {
it('should be an object with keys and values', (done) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

Groups.destroy({ where: { groupName: 'People' } }).then(() => done());
});

describe('POST: (/api/v1/group) - Create', () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

});
after((done) => {
UserGroups.destroy({ where: { groupName: 'People' } });
Groups.destroy({ where: { groupName: 'People' } }).then(() => done());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

@bumsyalao bumsyalao force-pushed the feedback-implementation branch from 34ac981 to 89bc76e Compare November 17, 2017 10:59
@bumsyalao bumsyalao temporarily deployed to postit-now November 17, 2017 10:59 Inactive
- Add search page for users
- Add Add User option
- Create Api route to add User to group
- Add footer to app
- Add heading to login and register form
- Add navbar to PageNotFound
- Fix heroku issue

[Delivers #152948431]
@bumsyalao bumsyalao force-pushed the feedback-implementation branch from 89bc76e to 5fb5077 Compare November 17, 2017 11:02
@@ -1,18 +1,19 @@
/* eslint-disable no-unused-expressions */
import chai from 'chai';
import models from '../../server/models';
import models from '../../models';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

metaData: paginate(count, limit, offset)
});
})
.catch(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then(({ rows: users, count }) => {
res.status(200).send({
message: 'Users found',
users,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

users,
metaData: paginate(count, limit, offset)
})
.then(({ rows: users, count }) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'destructuring binding' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then((userGroups) => {
res.status(200).send({ userGroups });
})
.catch(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

attributes: ['groupName']
})
.then((userGroups) => {
res.status(200).send({ userGroups });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});
attributes: ['groupName']
})
.then((userGroups) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

Users.findOne({ where: { id: userId } })
.then((user) => {
if (user.length === 0) {
res.status(404).send({ message: 'No User Found' });
} else {
res.status(200).send({ userInfo: user.filterUserDetails() });
}
}).catch(() => {
})
.catch(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

@@ -1,18 +1,19 @@
/* eslint-disable no-unused-expressions */
import chai from 'chai';
import models from '../../server/models';
import models from '../../models';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

metaData: paginate(count, limit, offset)
});
})
.catch(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then(({ rows: users, count }) => {
res.status(200).send({
message: 'Users found',
users,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

users,
metaData: paginate(count, limit, offset)
})
.then(({ rows: users, count }) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'destructuring binding' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then((userGroups) => {
res.status(200).send({ userGroups });
})
.catch(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

attributes: ['groupName']
})
.then((userGroups) => {
res.status(200).send({ userGroups });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});
attributes: ['groupName']
})
.then((userGroups) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

Users.findOne({ where: { id: userId } })
.then((user) => {
if (user.length === 0) {
res.status(404).send({ message: 'No User Found' });
} else {
res.status(200).send({ userInfo: user.filterUserDetails() });
}
}).catch(() => {
})
.catch(() => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

app.get('/api', (req, res) => res.status(200).send({
message: 'Welcome to the PostIt API!',
}));
app.get('/api', (req, res) =>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

phoneNumber: '09087667344',
password: 'medicine'
};
const signupUser = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

},
{
classMethods: {
associate: (models) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

});
};

export default sendMail;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'export' is only available in ES6 (use 'esversion: 6').

if (error) {
return error;
}
console.log(`${info.messageId} send: ${info.response}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

const mailOptions = {
from: '"POST_IT" <[email protected]>',
to: email,
subject: `You have a ${priorityHeader} message`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

});

// setup email data with unicode symbols
const mailOptions = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});

// create reusable transporter object using the default SMTP transport
const transporter = nodemailer.createTransport({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

let email = '';

users.forEach((user) => {
email += `${user.User.email},`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

// get email of the users
let email = '';

users.forEach((user) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

app.get('/api', (req, res) => res.status(200).send({
message: 'Welcome to the PostIt API!',
}));
app.get('/api', (req, res) =>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

phoneNumber: '09087667344',
password: 'medicine'
};
const signupUser = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

},
{
classMethods: {
associate: (models) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

});
};

export default sendMail;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'export' is only available in ES6 (use 'esversion: 6').

if (error) {
return error;
}
console.log(`${info.messageId} send: ${info.response}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

const mailOptions = {
from: '"POST_IT" <[email protected]>',
to: email,
subject: `You have a ${priorityHeader} message`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

});

// setup email data with unicode symbols
const mailOptions = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});

// create reusable transporter object using the default SMTP transport
const transporter = nodemailer.createTransport({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

let email = '';

users.forEach((user) => {
email += `${user.User.email},`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

// get email of the users
let email = '';

users.forEach((user) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

@bumsyalao bumsyalao force-pushed the feedback-implementation branch from 2e71ff9 to c176eb1 Compare November 24, 2017 11:37
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c176eb1 on feedback-implementation into ** on master**.

@bumsyalao bumsyalao force-pushed the feedback-implementation branch from c176eb1 to a4e5762 Compare November 27, 2017 13:18

.icon-pointer {
cursor: pointer;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files should end with a trailing newline

@@ -175,10 +189,58 @@ nav ul a {
margin-top: 10%;
}
.collection {
margin-bottom: 100px !important;
margin-bottom: 100px !important;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!important should not be used

margin-right: 30px;
}
margin-top: 50px;
a {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be preceded by an empty line

@@ -125,7 +139,7 @@ nav ul a {
}

&:hover {
background: rgba(229, 115, 115, 0.08);
background: rgba(229, 115, 115, 0.08);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color literals like rgba(229, 115, 115, 0.08) should only be used in variable declarations; they should be referred to via variable everywhere else.

background: #fff;
width: calc(100% - 300px);
margin-top: 0;
border-top: 1px solid #aaa;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color literals like #aaa should only be used in variable declarations; they should be referred to via variable everywhere else.

right: 0;
bottom: 0;
margin: 0 auto 30px auto;
background: #fff;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color literals like #fff should only be used in variable declarations; they should be referred to via variable everywhere else.

position: fixed;
right: 0;
bottom: 0;
margin: 0 auto 30px auto;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorthands of length 4 are not allowed. Value was 0 auto 30px auto
Shorthand form for property margin should be written more concisely as 0 auto 30px instead of 0 auto 30px auto

border-top: 1px solid #aaa;
height: 200px;
.message-holder {
position: fixed;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered background, border-top, bottom, height, margin, margin-top, position, right, width

margin: 0 auto;
max-height: calc(100% - 340px);
overflow: scroll;
border: none;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

border: 0 is preferred over border: none

@bumsyalao bumsyalao force-pushed the feedback-implementation branch from a4e5762 to 904f0aa Compare November 27, 2017 13:19
@bumsyalao bumsyalao temporarily deployed to postit-now November 27, 2017 13:20 Inactive
- Users should only see group they belong to
@bumsyalao bumsyalao force-pushed the feedback-implementation branch from 904f0aa to 035c651 Compare November 27, 2017 13:21
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 035c651 on feedback-implementation into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 035c651 on feedback-implementation into ** on master**.

- include group users page
- remove redundant files
- remmove wrong import name
.then(group => res.status(200).send({
group
}))
.catch(error => res.status(404).send(error));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then(group => res.status(200).send(group))
.catch(error => res.status(400).send(error));
.then(group => res.status(200).send({
group

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

*/
retrieveGroup(req, res) {
Groups.findById(req.params.groupid)
.then(group => res.status(200).send(group))
.catch(error => res.status(400).send(error));
.then(group => res.status(200).send({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then(allGroups => res.status(200).send({
allGroups
}))
.catch(error => res.status(404).send(error));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.then(allGroups => res.status(200).send(allGroups))
.catch(error => res.status(400).send(error));
.then(allGroups => res.status(200).send({
allGroups

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

})
.then(allGroups => res.status(200).send(allGroups))
.catch(error => res.status(400).send(error));
.then(allGroups => res.status(200).send({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

.catch((error) => {
res.status(400).send(`user groups error: ${error.message}`);
res.status(400).send(`${error.message}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'template literal syntax' is only available in ES6 (use 'esversion: 6').

})
.then(savedGroup => res.status(200).send(savedGroup))
.then(savedGroup => res.status(200).send({
savedGroup,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

})
.then(savedGroup => res.status(200).send(savedGroup))
.then(savedGroup => res.status(200).send({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 257686c on feedback-implementation into ** on master**.

}
.link-underline {
text-decoration: underline;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files should end with a trailing newline

}
.btn-space {
margin-right: 1rem;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be followed by an empty line


.urgent {
background: red;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule declaration should be followed by an empty line

}

.urgent {
background: red;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color red should be written in hexadecimal form as #ff0000
Color literals like red should only be used in variable declarations; they should be referred to via variable everywhere else.


.priority-badge {
background: red;
color: white;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered background, border-radius, color, padding
Color white should be written in hexadecimal form as #ffffff
Color literals like white should only be used in variable declarations; they should be referred to via variable everywhere else.

@bumsyalao bumsyalao force-pushed the feedback-implementation branch from f7935b2 to b6c88ec Compare November 29, 2017 00:31
it('should be valid if compared', () => {
expect(person.verifyPassword(userInfo.password)).to.be.true;
it('should be valid if compared', (done) => {
expect(person.verifyPassword(userDetails.password)).to.be.true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b6c88ec on feedback-implementation into ** on master**.

user.update({
Users.findOne({
where: { email }
}).then((user) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

} else {
user.update({
Users.findOne({
where: { email }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

attributes: ['groupId', 'groupName']
})
.then((userGroups) => {
res.status(200).send({ userGroups });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});
attributes: ['groupId', 'groupName']
})
.then((userGroups) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

*/
viewUser(req, res) {
const userId = req.body.userId;
const userId = req.decoded.userId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

phoneNumber: foundUser.phoneNumber
};
return res.status(200).send({
token,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

secret,
{ expiresIn: '1 day' }
);
const userDetails = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

*/
signin(req, res) {
if (req.body.username && req.body.password) {
Users.findOne({ where: { username: req.body.username } })
.then((foundUser) => {
if (foundUser && foundUser.verifyPassword(req.body.password)) {
const token = jwt.sign({
const token = jwt.sign(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

return res.status(200).send({ token, userInfo });
return res.status(200).send({
token,
userInfo,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

email: newUser.email
};
return res.status(200).send({ token, userInfo });
return res.status(200).send({
token,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

user.update({
Users.findOne({
where: { email }
}).then((user) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

} else {
user.update({
Users.findOne({
where: { email }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

attributes: ['groupId', 'groupName']
})
.then((userGroups) => {
res.status(200).send({ userGroups });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

});
attributes: ['groupId', 'groupName']
})
.then((userGroups) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').

*/
viewUser(req, res) {
const userId = req.body.userId;
const userId = req.decoded.userId;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

phoneNumber: foundUser.phoneNumber
};
return res.status(200).send({
token,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

secret,
{ expiresIn: '1 day' }
);
const userDetails = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

*/
signin(req, res) {
if (req.body.username && req.body.password) {
Users.findOne({ where: { username: req.body.username } })
.then((foundUser) => {
if (foundUser && foundUser.verifyPassword(req.body.password)) {
const token = jwt.sign({
const token = jwt.sign(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

return res.status(200).send({ token, userInfo });
return res.status(200).send({
token,
userInfo,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

email: newUser.email
};
return res.status(200).send({ token, userInfo });
return res.status(200).send({
token,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'object short notation' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants