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

#162163267 create view and edit user profile #14

Merged
merged 23 commits into from
Dec 10, 2018

Conversation

SokoPaulSokool
Copy link
Contributor

@SokoPaulSokool SokoPaulSokool commented Dec 7, 2018

what does this PR do?

Adds create view and edit of user profile

Description of tasks to be completed

writing unit tests for this feature
Have these endpoints working
POST /api/user
PUT /api/user
GET /api/profiles/:username

How this can be tested manually

Clone the repo,
Install the requirements with pip install -r requirements.txt
To run tests, run ./manage.py test

Run python manage.py runserver
Test the endpoints in postman

Profile creation

Profile is created when user signs up

To test this

Send post request to http://127.0.0.1:8000/api/users/
with body

{
"user":{
	"email":"soko@gmail.com",
	 "username":"soko",
	"password":"sokosoko"
	}
}

Then login that user by sending a POST request to http://127.0.0.1:8000/api/users/login/
Login data format --> POST /api/users/login/
with body

{
  "user":{
	"email":"soko@gmail.com",
	"username":"soko",
	"password":"sokosoko"
}
 }

get the token returned

then send a GET request to http://127.0.0.1:8000/api/profiles/soko
image

Test update profile

Send a PUT request to http://127.0.0.1:8000/api/user/
with body and authentication token

{
  "user":{
    "email": "paul@andela.com",
    "bio": "I like to skateboard",
    "image": "https://www.andela.com/paul.jpg"
  }
}

Soko Paul and others added 9 commits December 7, 2018 08:37
Add all the initial files required for the profile application

[Delivers #162163267]
This adds routes to connect the profile app. Define model for Profile and a relationship to User. Create view to retrive profile

[Delivers #162163267]
This commit adds a ProfileJSONRenderer class to renderers.py file. The class when added to renderer_classes in the views formarts the returned profile and lets the default renderer handle exceptions raised

[Delivers #162163267]
This commit adds a signal that is run when the user is created the first time and. This signal the creation of a profile for that user.

[Delivers #162163267]
This commit adds a signal that is run when the user is created the first time and. This signal the creation of a profile for that user.

[Delivers #162163267]
This commit adds signals file with the create profile function

[Delivers #162163267]
This commit adds an update function to the ProfileRetrieveView

[Delivers #162163267]
This commit adds authentication to the profile endpoints. This makes them requie jwt token to be accessed

[Delivers #162163267]
This commit adds tests for getting a profile of an existing user

[Delivers #162163267]
Copy link
Contributor

@collin5 collin5 left a comment

Choose a reason for hiding this comment

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

Have you fixed issues with edit bio and profile_pic? Also add tests for this.

KicaRonaldOkello and others added 14 commits December 7, 2018 17:33
This commit adds edit image and bio functionality when a user sends a post request

[Delivers #162163267]
Add all the initial files required for the profile application

[Delivers #162163267]
This adds routes to connect the profile app. Define model for Profile and a relationship to User. Create view to retrive profile

[Delivers #162163267]
This commit adds a ProfileJSONRenderer class to renderers.py file. The class when added to renderer_classes in the views formarts the returned profile and lets the default renderer handle exceptions raised

[Delivers #162163267]
This commit adds a signal that is run when the user is created the first time and. This signal the creation of a profile for that user.

[Delivers #162163267]
This commit adds an update function to the ProfileRetrieveView

[Delivers #162163267]
This commit adds authentication to the profile endpoints. This makes them requie jwt token to be accessed

[Delivers #162163267]
This commit adds tests for getting a profile of an existing user

[Delivers #162163267]
This commit adds edit image and bio functionality when a user sends a post request

[Delivers #162163267]
This commit adds a functionality to edit bio and image when user sends PUT request to /api/user/
[Delivers #162163267]
This commit adds test for update bio and image

[Delivers #162163267]
This commit adds a check if the profile one is trying to get exists. Adds ProfileDoesNotExist class to raise exception if it does not exist. It also removes update function from ProfileRetrieveView because it was not being used anywhere. Also adds test for this check

[Delivers #162163267]
@SokoPaulSokool
Copy link
Contributor Author

I have fixed the issues with edit bio and image and added the tests

@collin5 collin5 merged commit 4557108 into develop Dec 10, 2018
@collin5 collin5 deleted the ft-create-user-profile-162163267 branch December 10, 2018 14:26
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.

None yet

5 participants