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

V0.11 refactor resource classes to modules #1406

Merged
merged 25 commits into from
Sep 19, 2023

Conversation

lgebhardt
Copy link
Member

@lgebhardt lgebhardt commented Jun 7, 2023

Putting this up to float the idea of loading the resource retrieval code in modules to allow us manage having the v0.9, v0.10 and v0.11 resource retrieval logic added to the app's Resource derived classes instead of deriving from separate JR created XResource classes.

This PR is definitely not ready to merge. I'm mostly looking for feedback on the last commit, including how we want to name these modules.

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry'
spec.add_development_dependency 'concurrent-ruby-ext'
spec.add_development_dependency 'database_cleaner'
spec.add_development_dependency 'hashie'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, at least it's dev only :)

@@ -31,6 +31,8 @@ def test_get_not_found
end

def test_post_sessions
skip "This test isn't compatible with v09" if testing_v09?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lgebhardt lgebhardt marked this pull request as ready for review September 18, 2023 14:40
@lgebhardt lgebhardt merged commit a2fc02f into v0-11-dev Sep 19, 2023
33 checks passed
@lgebhardt lgebhardt deleted the v0-11-refactor-to-modules branch September 19, 2023 18:20
lgebhardt added a commit that referenced this pull request Sep 19, 2023
* Restore previous include directives behavior

* Default sort use _primary_key

* Remove support for pluck attributes

* Pass relationship instead of relationship name

* Update copyright date

* Ignore docker-compose override files

* add _relation_name method

* Rework resource class to support using modules for retrieving resources by way of a `resource_retrieval_strategy`

Removes BasicResource class and replaces ActiveRelationResource with a module

* Use `_relationship` helper method

* Add ActiveRelationRetrieval

Allows retrieval of resources by querying the primary table and joining the source table - the opposite of the v10 version

* Skip extra pluck queries when not caching a resource

* Test Cleanup

* Adjust tested query counts based on default_resource_retrieval_strategy

* create_implicit_polymorphic_type_relationships

* Add ActiveRelationRetrievalV09

* Move resource down in the load order

* Use underscore instead of downcase

* Refactor Resource to load retrieval strategy as class loads

* Simplify loading resource retrieval strategy modules

Add SimpleResource that does not load a resource retrieval strategy module

* Remove no longer need deferred_relationship code

* Add warning about potentially unused `records_for_populate`

* Rework loading the resource_retrieval_strategy to fix issue in real projects

* Use SortedSets for resource_identities

* Add sorted_set gem

* Remove rails 5 support
lgebhardt added a commit that referenced this pull request Apr 18, 2024
* Restore previous include directives behavior

* Default sort use _primary_key

* Remove support for pluck attributes

* Pass relationship instead of relationship name

* Update copyright date

* Ignore docker-compose override files

* add _relation_name method

* Rework resource class to support using modules for retrieving resources by way of a `resource_retrieval_strategy`

Removes BasicResource class and replaces ActiveRelationResource with a module

* Use `_relationship` helper method

* Add ActiveRelationRetrieval

Allows retrieval of resources by querying the primary table and joining the source table - the opposite of the v10 version

* Skip extra pluck queries when not caching a resource

* Test Cleanup

* Adjust tested query counts based on default_resource_retrieval_strategy

* create_implicit_polymorphic_type_relationships

* Add ActiveRelationRetrievalV09

* Move resource down in the load order

* Use underscore instead of downcase

* Refactor Resource to load retrieval strategy as class loads

* Simplify loading resource retrieval strategy modules

Add SimpleResource that does not load a resource retrieval strategy module

* Remove no longer need deferred_relationship code

* Add warning about potentially unused `records_for_populate`

* Rework loading the resource_retrieval_strategy to fix issue in real projects

* Use SortedSets for resource_identities

* Add sorted_set gem

* Remove rails 5 support
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.

2 participants