-
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
#164489929 create user profile #29
Conversation
f3cff02
to
74da9d1
Compare
controllers/user.js
Outdated
}; | ||
const updatedUser = await User.update( | ||
profile, { where: { id }, returning: true, plain: true } | ||
); |
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.
Unexpected newline before ')' function-paren-newline
controllers/user.js
Outdated
bio: req.body.bio ? req.body.bio : foundUser.bio, | ||
image: req.file ? req.file.url : foundUser.image | ||
}; | ||
const updatedUser = await User.update( |
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.
Unexpected newline after '(' function-paren-newline
74da9d1
to
20c78fd
Compare
controllers/user.js
Outdated
image: req.file ? req.file.url : foundUser.image | ||
}; | ||
const updatedUser = await User.update(profile, | ||
{ where: { id }, returning: true, plain: true }); |
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.
Expected a newline before ')' function-paren-newline
controllers/user.js
Outdated
bio: req.body.bio ? req.body.bio : foundUser.bio, | ||
image: req.file ? req.file.url : foundUser.image | ||
}; | ||
const updatedUser = await User.update(profile, |
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.
Expected a newline after '(' function-paren-newline
1daae43
to
37c737a
Compare
controllers/user.js
Outdated
bio: req.body.bio ? req.body.bio : foundUser.bio, | ||
image: req.file ? req.file.url : foundUser.image | ||
}, | ||
{ where: { id }, returning: true, plain: true }); |
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.
Expected a newline before ')' function-paren-newline
controllers/user.js
Outdated
const id = parseInt(req.params.id, 10); | ||
const foundUser = await User.findOne({ where: { id } }); | ||
if (foundUser) { | ||
const updatedUser = await User.update({ |
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.
Expected a newline after '(' function-paren-newline
37c737a
to
8528837
Compare
Good work @Paccy10, I appreciate the way you handled your tasks. But I realized that you are passing user_id in the endpoint for updating the user's profile. I think you don't need to add user_id in the URL because we already have it in the token. As long as we are using Passport, you can access that user_id from user's requests. So you do not need that middleware for checking user account because it compares both user_id from token and URL. For example: |
8528837
to
00483e2
Compare
test/1-user.js
Outdated
invalidToken, | ||
validToken, | ||
profile1, | ||
profile2 |
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.
'profile2' is defined but never used no-unused-vars
00483e2
to
00d78a1
Compare
00d78a1
to
a2de2d5
Compare
3d6895c
to
185920a
Compare
import app from '../index'; | ||
import { | ||
signup1, | ||
signup3, |
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.
'signup3' is defined but never used no-unused-vars
ae76ff7
to
01e3de6
Compare
@Paccy10 , Please fix these merge conflicts |
01e3de6
to
46d257d
Compare
46d257d
to
0eae920
Compare
-getting user profile -editing user profile [Delivers #164489929]
0eae920
to
264b46f
Compare
What does this PR do?
This PR adds the functionality of creating a user profile
Description of Task to be completed?
GET: /api/users/:id/profile
endpoint for getting a user profilePUT :/api/users/:id/profile
endpoint for updating a user profileGET: /api/users/:id/profile
endpointPUT :/api/users/:id/profile
endpointHow should this be manually tested?
http://localhost:3000/api/users/:id/profile
(replace:id
with the id of the user you want to view his profile), then send and you will get the profilehttp://localhost:3000/api/users/:id/profile
(replace:id
with your id), then add in the body what you want to update likeusername
,bio
orimage
and send, your profile will be updated.What are the relevant pivotal tracker stories?
#164489929
Screenshots (if appropriate)
Response