DEV Community

Krinskumar Vaghasia
Krinskumar Vaghasia

Posted on

0.4 - week - 2 - Progress

This is my part two of my contribution and you can check my part one here. Last time I talked about how I want to tackle this and in this blog I will be talking about my progress.

Intro

So I am making this contribution on this issue where I am supposed to tweak the response based on the status of the user. Currently, the server is returning 500 if the user's dataset is not found. We want to return 404 if the user does not exist and 410 if the user is deleted.

What I did

I first tried to find the code which was actually returning the 500 code but no matter where I looked in the repository, I was not able to find the actual code. I am aware of what the syntax of a backend server look like on javascript. but this was different. and the reason why I found nothing was because all of the important code was in some other repository and I had to download that and link all the files to make the servers and the frontend work. They had some pretty good documentation for how to link these repos so that they work together and I was also able to find all of the necessary code in that repo. This is my fork of that. Then comes the understanding the repo. This part took me a lot of time because the code was not similar to express and everything was working with the use of context which was my first time.

Another issue was that I was not able to make a call to /inbox route which was the route I was working on from the frontend. This was because this route is to be called from the backend. I reached out to the devs in a chat room that they invited me and they recommended me to use postman. One of the issue I was facing was also because I cloned a broken version of the code which was breaking the inbox route that I was working on. I pulled the new version which was correct and started working.

The context made it very difficult for me to understand the code and I had to manually look for code that made sense and was used by my inbox route. I made a change in the deepest level of the code and that broke everything, which made me realize that this code is common and is being used by a lot of other routes. So moving forward I had to very careful and make sure I am not changing the code not at the deepest level at least. Just getting used to the code and tweaking things to deepen my understanding took me like a week. Everyone in the chat room were very helpful and made sure I understand what I was doing. Finally I added a code block which was an additional check to check if a user exists before we move further in the code and return 404 or 410 based on the status of the user. You can look at the change here which is a draft PR. The reason I raised a draft PR was to run my changes with the developers before I start adding tests to make sure that the code I added was correct. Its possible that by the time you look at his PR, it either not a draft or already merged. I also wrote a bunch of questions in the draft PR and currently I am waiting for the questions to be answered.

Moving forward

Now I want to make sure I am in loop with the developers and then add tests and documentation and finally get the PR merged. I have made this error where I write all of the code and raise a PR only to find out that something I am doing is not what the devs want. This time I am making sure that the changes I have are approved by the devs before I make a deeper dive.

Top comments (0)