Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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.