mentorship-backend icon indicating copy to clipboard operation
mentorship-backend copied to clipboard

Enhancement : Require mentor's approval for task completion

Open RiddhiAthreya opened this issue 4 years ago • 6 comments

Description

Task has got new property requires_approval: [bool]. If it's set to True during creation, task becomes "restricted" - i.e only mentor can mark it as done/completed. When mentee tries to mark it as done, he get's 401 Unauthorized.

Fixes #278

Type of Change:

  • Code

Code/Quality Assurance Only

  • This change requires a documentation update (software upgrade on readme file)
  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

When a mentee tries to update a task which has requires_approval set to True Screenshot (190)

creating a task with required_approval set to True Screenshot (191)

When mentor tries to update a task which has requires_approval set to True Screenshot (192)

Checklist:

  • [x] My PR follows the style guidelines of this project
  • [x] I have performed a self-review of my own code or materials
  • [x] I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] Update Postman API at /docs folder
  • [ ] Update Swagger documentation and the exported file at /docs folder
  • [ ] Update requirements.txt

Code/Quality Assurance Only

  • [x] My changes generate no new warnings
  • [x] My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • [ ] 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

RiddhiAthreya avatar Jul 06 '21 08:07 RiddhiAthreya

You'll also need to add migrations

epicadk avatar Jul 06 '21 09:07 epicadk

@epicadk can you please tell me how to add that?

RiddhiAthreya avatar Jul 06 '21 09:07 RiddhiAthreya

@epicadk can you please tell me how to add that?

I believe @mtreacy002 was going to create a doc for this?

epicadk avatar Jul 06 '21 13:07 epicadk

You'll also need to add migrations

@epicadk , IMO @RiddhiAthreya doesn't need to write a migration script here since the changes applies to dao object of Task and the logic used inside Task db model. The Task db model itself doesn't get affected with the changes here. I tried running flask db migrate and got the response below.

Screen Shot 2021-07-08 at 3 30 36 pm

Let me know if you have a different view on this 😉

mtreacy002 avatar Jul 08 '21 05:07 mtreacy002

@mtreacy002 true , only the task json object has changed, but the task table remains the same :smiley:

RiddhiAthreya avatar Jul 08 '21 07:07 RiddhiAthreya

@RiddhiAthreya any updates?

devkapilbansal avatar Sep 09 '21 08:09 devkapilbansal