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

DDD for HTTP resources #146

Merged
merged 1 commit into from
Apr 19, 2024
Merged

DDD for HTTP resources #146

merged 1 commit into from
Apr 19, 2024

Conversation

migduroli
Copy link
Member

@migduroli migduroli commented Apr 15, 2024

@migduroli migduroli added this to the 1.7.0 milestone Apr 15, 2024
@migduroli migduroli self-assigned this Apr 15, 2024
@migduroli migduroli added the enhancement New feature or request label Apr 15, 2024
@migduroli migduroli linked an issue Apr 15, 2024 that may be closed by this pull request
@migduroli
Copy link
Member Author

In trying to follow the same structure as we have for SQLAlchemyTableRepository, which contains a manager SQLAlchemyTableManager which is the one managing the execution of queries with the _connection object, we have created:

  • HTTPResourceManager
  • HTTPResourceRepository which derives from HTTPRepository and has a _resource_manager = HTTPResourceManager(self._resource, client).

However, following this pattern I find that the methods of HTTPResourceRepository are just wrappers of single-line methods of HTTPResourceManager. Does this mean we might not need HTTPResourceManager? Or, contrarily, does this mean the methods fo HTTPResourceManager need to do something else rather than jusr returning the response of the client?

@migduroli
Copy link
Member Author

migduroli commented Apr 17, 2024

In trying to follow the same structure as we have for SQLAlchemyTableRepository, which contains a manager SQLAlchemyTableManager which is the one managing the execution of queries with the _connection object, we have created:

  • HTTPResourceManager
  • HTTPResourceRepository which derives from HTTPRepository and has a _resource_manager = HTTPResourceManager(self._resource, client).

However, following this pattern I find that the methods of HTTPResourceRepository are just wrappers of single-line methods of HTTPResourceManager. Does this mean we might not need HTTPResourceManager? Or, contrarily, does this mean the methods fo HTTPResourceManager need to do something else rather than jusr returning the response of the client?

Solved! The HTTPResourceManager will return the data itself, i.e. will wait for the response and run checks of the status_code. If the status_code satisfies the standard REST response codes, then it will parse the data (if available). Otherwise, it will raise an appropriate exception.

@migduroli migduroli marked this pull request as ready for review April 19, 2024 00:17
@migduroli migduroli merged commit daeee47 into release/v1.7.0 Apr 19, 2024
5 checks passed
@migduroli migduroli deleted the feature/ddd-http branch April 19, 2024 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Domain-driven design for HTTP resources
1 participant