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: Pedro Routaboul
Explain your solution
Tell us how you solved each of the excercises.
Excercise 1 - Add filter by technologyId for GET /courses endpoint
*I added the
technologyId
field tofilterFields
to enable it.Then, i created the test and i run it *
Excercise 2 - create a GET /admin/billing/getInvoices
*I created the
getInvoices
function, that do a request togetChargeableStudents
endpoint for get the student's info, but i spend too mucch time because i didnt know how to re-call. Finally i could do it, but i couldn't finish it *Excercise 3 - Add Middleware for caching GET requests
It was the easier, i made the middleware that catch the information of all request GET (but not the
urlSinCache
), and i saved in global.cache.[req.originalUrl], it mean that first the middleware chech if he has some information in this object, and if yes, return it , and if not have any info. call next().Also I rewrite te funtion response200 to save the response.
if it is a POST or PUT i clean the global.cache.[req.originalUrl]
Excercise 4 - create GET /stats/failuresByStates
*I find all the notes and i filter by "failed", then I get only the students ids, delete the repetitions.
I create an array whit the countries and his count.
last but not least i convert to an object and i send it by response200.
also i made the tests but i couldnt finish it *
Share your ideas about the application
In controlles/billing my be is a good idea made an unique funtion to get the Chargeable Students, but if the idea was that they supose are in "diferents applications, it ok "