Updated handling of multiple relationships between same records #167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR
This is an initial attempt at addressing performant-software/core-data-cloud#509 by updating how we handle the case of multiple relationships between the same pair of records, so that the returned array will have only one entry for each related record, and when applicable the
project_model_relationship_uuidfield will contain an array of the UUIDs of all relationships between them.Issues and questions
project_model_relationship_uuidfield is different.project_model_relationship_inversefield...really in the case of multiple relationships that should also be an array, but I couldn't figure out how to get it to line up. In fact it seems like right now we're making the assumption that at least one ofitem.relationshipsanditem.related_relationshipsis empty (seecore-data-connector/app/serializers/concerns/core_data_connector/public/v1/typeable_serializer.rb
Line 20 in d4a600c
.distinctmethod, since the field we're ordering by is only in the joined table...I'm sure there's a way but this seemed to be just outside my ability to decipher Rails stuff.