-
Notifications
You must be signed in to change notification settings - Fork 2
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
#168781679 User Login #19
Conversation
63f3f8b
to
e77d5b3
Compare
409cfbe
to
3765702
Compare
- creates endpoint for user to login - gives user a token upon signin [Finishes#168781679]
3765702
to
6b17d8c
Compare
6b17d8c
to
e269ec5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @alainmateso so far
Just a few changes though
- Remove that unncessary variable in
.env.example
- Update the PR body to the new
login
endpoint url/api/v1/users/login
- Update the screenshots too
e269ec5
to
9a44a3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider refactoring your controller
|
||
static async signIn(req, res) { | ||
const { email, password } = req.body; | ||
const user = await models.users.findOne({ where: { email } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new line here
const user = await models.users.findOne({ where: { email } }); | ||
if (!user) { | ||
return responseError(res, 400, strings.users.error.LOGIN_FAILURE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a new line here
import app from '../index'; | ||
import strings from '../utils/stringsUtil'; | ||
import mockData from './mockData/mockData'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @alainmateso . The feature works as expected just a few changes are required to improve readability.
- creates endpoint for user to login - gives user a token upon signin - adheres to the current structre [Finishes#168781679]
9a44a3f
to
29d4629
Compare
What does this PR do?
Add user login functionality.
Description of Task to be completed?
How should this be manually tested?
npm install
sequelize db:migrate
sequelize db:seed:all
npm run dev
POST
request tohttp://localhost:3000/api/v1/users/login
Any background context you want to provide?
N/A
What are the relevant pivotal tracker stories?
#168781679
Screenshots (if appropriate)
Questions:
N/A