in-fin-neat / in-fin-neat-core

Personal Finances tool
1 stars 0 forks source link

Create a router map for the user service api #57

Open leonardohscastilho opened 2 days ago

leonardohscastilho commented 2 days ago

Create a router map for the user service API endpoints. This will lead the code to be more clean, readble and easy to maintain while the code gets bigger.

Basically change what is now:

    try:
        if resource == "/users/{userId}/login" and http_method == "POST":
        ...

        elif resource == "/users/{userId}/bank-accounts" and http_method == "GET":
        ....
        elif (
            resource == "/users/{userId}/bank-accounts/{iban}" and http_method == "PUT"
        ):
        ...

To something like:

router_map = {
  'some/api/path': some_handler_function_for_that_path,
  'some/api/path1': some_handler_function_for_that_path1,
  'some/api/path2': some_handler_function_for_that_path2
}