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

Refactor main code, separate code into modules #55

Merged
merged 11 commits into from
Nov 18, 2023
Merged

Commits on Nov 17, 2023

  1. feat(middlewares): add CustomRequestMiddleware to handle custom form …

    …and files properties in Flask requests
    
    test(callbacks_controller_test): add test for creating a message in callbacks controller
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    a1fabfe View commit details
    Browse the repository at this point in the history
  2. fix(__init__.py): fix import statement for HookMiddleware class

    feat(hook_middleware.py): add HookMiddleware class to register hooks for controller methods in blueprints
    
    The import statement for the `HookMiddleware` class in `__init__.py` was incorrect. It was fixed to import from the correct module.
    
    A new file `hook_middleware.py` was added to the `middlewares` directory. This file contains the `HookMiddleware` class which is responsible for registering hooks for controller methods in blueprints. The `register` method takes a controller instance and a blueprint instance as arguments, and registers the appropriate hooks based on the attributes of the controller instance. The `accept_attributes` property defines the list of attributes that are accepted as hooks.
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    516595b View commit details
    Browse the repository at this point in the history
  3. feat(mvc_flask): add InputMethodHelper class to handle HTML-related o…

    …perations
    
    The InputMethodHelper class is added to the mvc_flask/helpers/html module. This class provides methods for generating HTML input elements with specific methods (like PUT and DELETE) that are not natively supported by HTML forms. The class includes the following methods:
    
    - input_hidden_method: Determines the appropriate HTML string to return based on the given method string.
    - _input_html: Generates a hidden HTML input element.
    - _put: Generates a hidden input field for the PUT method.
    - _delete: Generates a hidden input field for the DELETE method.
    
    This class is intended to be used in the FlaskMVC class in the mvc_flask/__init__.py file. The inject_stage_and_region method in the FlaskMVC class now uses the InputMethodHelper class to generate the appropriate HTML for the method attribute in the returned dictionary.
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    d7cbddc View commit details
    Browse the repository at this point in the history
  4. refactor(__init__.py): rename MethodOverrideMiddleware class to Metho…

    …dOverrideMiddleware for consistency and clarity
    
    refactor(hook_middleware.py): rename HookMidleware class to HookMiddleware for consistency and clarity
    feat(__init__.py): add import statements for MethodOverrideMiddleware and CustomRequestMiddleware
    feat(__init__.py): remove unused Hook class and its related code
    feat(__init__.py): update app.request_class to use CustomRequestMiddleware instead of CustomRequest
    feat(__init__.py): update app.wsgi_app to use MethodOverrideMiddleware instead of HTTPMethodOverrideMiddleware
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    6ea1179 View commit details
    Browse the repository at this point in the history
  5. feat(callbacks_controller.py): add CallbacksController class with ind…

    …ex method and before_request callback
    
    feat(routes.py): add route for callbacks with only index method
    test(routes_test.py): add tests for the newly added callbacks route and controller
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    4a68f9d View commit details
    Browse the repository at this point in the history
  6. fix(messages_controller.py): change query method from get to `filte…

    …r_by` to handle cases where the message with the given id does not exist
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    0d8571a View commit details
    Browse the repository at this point in the history
  7. fix(hook_middleware.py): format the list comprehension for better rea…

    …dability
    
    fix(custom_request_middleware.py): remove extra blank line
    fix(callbacks_controller.py): change single quotes to double quotes for consistency
    fix(routes_test.py): format the assert statement for better readability
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    3852e77 View commit details
    Browse the repository at this point in the history
  8. fix(mvc_flask): fix typo in method_override_middleware filename

    feat(mvc_flask): add method_override_middleware to handle HTTP method override functionality
    
    The typo in the filename of the method_override_middleware module has been fixed. The correct filename is now method_override_middleware.py.
    
    A new file, method_override_middleware.py, has been added to the mvc_flask/middlewares/http directory. This file contains the implementation of the MethodOverrideMiddleware class, which is responsible for handling HTTP method override functionality. The middleware allows clients to override the HTTP method of a request by including a special "_method" parameter in the request body. The allowed methods for override are GET, POST, DELETE, PUT, and PATCH. The middleware also handles cases where the overridden method is a bodyless method (GET, HEAD, OPTIONS, DELETE) by setting the appropriate values in the WSGI environment.
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    a805177 View commit details
    Browse the repository at this point in the history
  9. fix(__init__.py): update import statement for RouterMiddleware to ref…

    …lect new file structure
    
    feat(router_middleware.py): add RouterMiddleware class to manage routes in a web application
    feat(namespace_middleware.py): add NamespaceMiddleware class to create namespaces for routes
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    e15d270 View commit details
    Browse the repository at this point in the history
  10. refactor(__init__.py): remove unused imports and commented out code

    feat(blueprint_middleware.py): add BlueprintMiddleware class to handle registering blueprints and routes dynamically
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    b405705 View commit details
    Browse the repository at this point in the history
  11. refactor(mvc_flask): reorganize code structure and improve readability

    - Move FlaskMVC class to a separate file `mvc_flask.py` for better organization
    - Remove unnecessary imports and unused code from `__init__.py`
    - Rename `init_app` method in `FlaskMVC` class to `perform` for better clarity
    - Extract configuration logic into separate methods in `FlaskMVC` class for better modularity and readability
    - Update method names in `FlaskMVC` class to better reflect their purpose
    - Update variable names in `FlaskMVC` class for better clarity
    - Update comments and docstrings in `FlaskMVC` class for better understanding
    marcuxyz committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    ed81004 View commit details
    Browse the repository at this point in the history