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

Node Exam #15

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

Node Exam #15

wants to merge 2 commits into from

Conversation

pedroroutaboul
Copy link

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 to filterFields 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 to getChargeableStudents 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

  • Would you change anything about how the app was designed?
    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 "
  • What else would you add to it?

@pedroroutaboul pedroroutaboul changed the title Pedro Routaboul Node Exam Mar 21, 2019
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