Skip to content
Snippets Groups Projects
  • João Victor Risso's avatar
    1baf5471
    Refactor enrollments route to include query building · 1baf5471
    João Victor Risso authored
    Changes:
    - Add error handling in the database query function. When a database error
    occurs, it is logged in the server and a plain text response is returned to the
    user.
    - Implement the building of queries inside the API, which removes the
      need to have stored functions/procedures on the database, which is not
      flexible or efficient to maintain/extend.
    - Use route chaining to determine which function will build the query
      that needs to be executed. The last function is the one that actually
      sends the query to the database and send the response.
    
    Future Work:
    - Instead of returning a plain text response, return a HTTP 501 status,
      which is currently not possible. When one attempts to send such status
      the framework throws an error that the headers were already sent for
      the current request.
    - Chaining based on the route might not be the best solution here.
    Refactor enrollments route to include query building
    João Victor Risso authored
    Changes:
    - Add error handling in the database query function. When a database error
    occurs, it is logged in the server and a plain text response is returned to the
    user.
    - Implement the building of queries inside the API, which removes the
      need to have stored functions/procedures on the database, which is not
      flexible or efficient to maintain/extend.
    - Use route chaining to determine which function will build the query
      that needs to be executed. The last function is the one that actually
      sends the query to the database and send the response.
    
    Future Work:
    - Instead of returning a plain text response, return a HTTP 501 status,
      which is currently not possible. When one attempts to send such status
      the framework throws an error that the headers were already sent for
      the current request.
    - Chaining based on the route might not be the best solution here.