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

Notes #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Notes #13

wants to merge 3 commits into from

Conversation

bogdanerickm
Copy link

@bogdanerickm bogdanerickm commented Mar 21, 2019

Name: bogdan matuszyczk

Explain your solution

Tell us how you solved each of the excercises.

Excercise 1 - Add filter by technologyId for GET /courses endpoint

1 - I solved this issue just adding the parameter "technologyId"
to the filter parameters Array that already implemented.
It was simple due to the structure of the implemetation
and the filtering query mode.

Excercise 2 - create a GET /admin/billing/getInvoices

1- I decided to create a new endpoint that calls one which I developed previously,
by using a request to avoid to modify it.
From the response I can get the students that have to pay the course.
2- This data is used to make a call to the AFIP API in order
to get the corresponding id for each student. Then I used destructuring,
which allowed me to made it easier, to give format to the object that
will be send as the response required on this exercise.

Excercise 3 - Add Middleware for caching GET requests

1 - To solve this issue, firstly I create an array with URLs that are excluded from the middleware.
This is a scalable solution like the Issue 1, due to exclude other URL just need to add it
to the array that I mention before.

2 - Secondly, I ask who request method are using and depend if is a GET,
PUT or POST I do different things. Always I ask if that request is
in the local cache, and depending if is a POST or a PUT y delete from 
cache with a different form.

3 - Also I redefined the response200 , in this way I able to get the data 
in the callback to save it into cache and added to the new response.

Excercise 4 - create GET /stats/failuresByStates

1- Since there is an exams list and each exam has a list of marks,
I decided to create a new list with all those marks that represent a failed exam.

2- With this new list of failed marks,
I looked for each student that was related with each mark creating a new list. 
Taking into account this can result on duplicated students, 
due to the fact that they could failed more than one exam, 
I decided to use a dictionary structure to map each student 
with his/her city with a function that verify that the student wasnt 
added before.

Share your ideas about the application

  • Would you change anything about how the app was designed?

  • What else would you add to it?

    As a general observation, I considera that the model of the app seems
    very well dessigned.
    As a suggestion of what I may change, taking into account that one
    of the exercises asks for the amount of students that failed the exam
    by each state, and the posible way to get it is by looking for the
    state as a string, I think it would be better to create other entity (schema)
    that has the country, the state, postal code and the id. So that,
    we could have filter by state in a neatter way.
    On the other hand, I may add some relationships to all the squema
    that I have done on mongoose. For example: to relate the student
    to his/her exam.

Tests

According to the test, I would have prefer to developed some better tests for the app,
I think I could not dedicate enough time to do it, but I'm aware about the need to develop some more of them and on a neatter way.

@glmaljkovich glmaljkovich changed the base branch from glmaljkovich-patch-1 to master March 28, 2019 12:46
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.

1 participant