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

Delete mentorship request API #73

Merged

Conversation

isabelcosta
Copy link
Member

@isabelcosta isabelcosta commented Jul 1, 2018

Description

I developed the API to delete a mentorship request: DELETE /mentorship_relation/{id}
With these constraints:

  • Only the requester of the relation can delete this
  • The relation has to be in a pending state to be deleted

Fixes #65

Type of Change:

  • Code

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

  • Wrote tests for DAO class and the API itself.
  • DAO tests covers all the predicted use cases of the delete_request function. Its tests if the request is deleted or not from the database.
  • Ran these tests with success.

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • Update Swagger documentation and the exported file at /docs folder

Code/Quality Assurance Only

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@isabelcosta
Copy link
Member Author

Will fix the endpoint according to @m-murad suggestion:

DELETE /mentorship_relation/{id}


request = MentorshipRelationModel.find_by_id(request_id)

# verify if request exists
Copy link
Contributor

Choose a reason for hiding this comment

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

it is a good practice to avoid comments that include "what" a code line is doing rather that "why" a code line is there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you @Dilu9218! In the future for this case should I avoid these comments at all or does this code need a "why"?

@Dilu9218 Dilu9218 merged commit 8f9bacd into anitab-org:gsoc18-code Jul 5, 2018
@isabelcosta isabelcosta deleted the delete-mentorship-request-api branch July 5, 2018 20:29
@isabelcosta isabelcosta added the Program: GSOC Related to work completed during the Google Summer of Code Program. label Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: GSOC Related to work completed during the Google Summer of Code Program.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants