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

Update endpoint for task checking to be a simple update method

Open bartekpacia opened this issue 6 years ago • 9 comments

Is your feature request related to a problem? Please describe. My feature is related to the unability to "uncheck/unmark" task that was once marked as completed.

Describe the solution you'd like I'd like an endpoint like /mentorship_relation/{request_id}/task/{task_id}/uncomplete to be added. I'm also willing to work on it.

Describe alternatives you've considered Alternative solution would be to change the implementation on the Android side. In my opinion, checkboxes are a bit misleading for a user, as they imply that a task can be "unchecked". Example of such a confusing behavior below:

demo

bartekpacia avatar Dec 07 '19 17:12 bartekpacia

@bartekpacia thank you for reporting this issue 🎉 I have a doubt, do you think the api should be:

PUT /mentorship_relation/{request_id}/task/{task_id}/uncomplete

instead of:

PUT /mentorship_relation/{request_id}/task/{task_id}/

that receives a request body as:

{
   "complete": true
}

What do you think?

isabelcosta avatar Dec 09 '19 23:12 isabelcosta

I'll try to make a quick overview so it'll be easier to see the "big picture". Currently we have following endpoints for dealing with specific task in a relation (source):

POST /mentorship_relation/{request_id}/task DELETE /mentorship_relation/{request_id}/task/{task_id} PUT /mentorship_relation/{request_id}/task/{task_id}/complete

I'm not a REST API specialist by any means, but in my opinion this part of the API design could be designed better, like:

POST /mentorship_relation/{request_id}/task DELETE /mentorship_relation/{request_id}/task/{task_id} PUT /mentorship_relation/{request_id}/task/{task_id} <---

PUT is a method that suits our use case best (as we only need to update 1 property of the resource). Another advantage of this approach is that we'll need only 1 endpoint, not 2 (e.g ...{task_id}/complete and .../{task_id}/uncomplete).

Considering above, I'd lean towards the second approach.

bartekpacia avatar Dec 09 '19 23:12 bartekpacia

@isabelcosta Do you approve suggested changes? I'd like to do this

bartekpacia avatar Dec 17 '19 16:12 bartekpacia

@bartekpacia do you still want to work on this issue, which was approved already? Let me know so I can assign it to you ^^ Only then I can review. Trying to follow the Contributing Guidelines 🙃

isabelcosta avatar Mar 31 '20 23:03 isabelcosta

@isabelcosta I think it's done in #333

bartekpacia avatar Mar 31 '20 23:03 bartekpacia

@bartekpacia Indeed it is, but I am trying to start practicing better the guidelines, and I need issues to be assigned. I will assign this to you then, since we discussed this so much. I just wanted to know, if I start requesting changes if you wanted to fix them or leave it for other contributor

isabelcosta avatar Mar 31 '20 23:03 isabelcosta

oh wait...

isabelcosta avatar Mar 31 '20 23:03 isabelcosta

oK forget, I got it, the description is not up to date with what is really going to be done here. all good

isabelcosta avatar Mar 31 '20 23:03 isabelcosta

sure! I will try fixing merge conflicts first

bartekpacia avatar Mar 31 '20 23:03 bartekpacia