-
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
#167484603 Fetch all available profiles #19
Conversation
This allows an authenticated user to fetch other users profiles [Finishes #167484603]
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.
Working good. But first, there are some conflicts needed to be resolved
On it. This happened because of the merging. Let me rebase and get rid of the conflict |
This allows an authenticated user to fetch other users profiles [Finishes #167484603]
This allows an authenticated user to fetch all available profiles [Delivers #167484603]
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.
I also think the /api/profiles
endpoint shouldn't require authentication. You can also remove the auth requirement on /api/profiles/:username
src/controllers/profileController.js
Outdated
data: users | ||
}); | ||
} catch (err) { | ||
// console.log(err); |
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.
do not mute the error. I'd rather you throw the error, this is important for debugging purposes
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.
Okay...fixed!
src/tests/userprofile.test.js
Outdated
}); | ||
|
||
describe('GET /api/v1/profiles', () => { | ||
it('Should A list of profiles if user is identified', (done) => { |
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.
grammar: "Should return a list ..."
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.
Alright! done!
src/tests/userprofile.test.js
Outdated
}); | ||
}); | ||
|
||
describe('GET /api/v1/profiles', () => { |
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.
this looks like a copy of https://github.com/andela/coding-geeks-ah-backend/pull/19/files#diff-7e80fd915c1e3097f4adf33a8a3c7f0dR60
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.
I'd also like to see an assertion about the number of profiles returned is what we expect
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.
this looks like a copy of https://github.com/andela/coding-geeks-ah-backend/pull/19/files#diff-7e80fd915c1e3097f4adf33a8a3c7f0dR60
Ok...fixed
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.
I'd also like to see an assertion about the number of profiles returned is what we expect
On it...
What does this PR do?
user can successfully login test
Description of Task to be completed?
fetchProfiles
inside the classProfile
in theprofileController
file.routes
folder to fetch profiles with theget
methoduserProfile.test
file, add tests for this endpointswagger.json
file, add/api/v1/profiles
in the swagger file's path to document this endpointHow should this be manually tested?
In Postman or Swagger or any other tool of your choice visit this enpoint:
/api/v1/profiles
to fetch a list of profilesAny background context you want to provide:
To access this endpoint, User must be authenticated. And use the token generated for Loggin or Registration as
Authorisation
in the 'header'.What are the relevant pivotal tracker stories?
List user functionality
Screenshots?
In Postman
![Screen Shot 2019-08-14 at 04 22 29](https://user-images.githubusercontent.com/50101879/63011626-fbbfee00-be88-11e9-8c25-7df656766edf.png)
In swagger
![Screen Shot 2019-08-14 at 04 20 36](https://user-images.githubusercontent.com/50101879/63011657-0a0e0a00-be89-11e9-8e09-8320c8a3d28f.png)