Skip to content

Changes to get entities and services count associated with label #123

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

Merged
merged 4 commits into from
Dec 27, 2021

Conversation

saxenakshitiz
Copy link
Contributor

No description provided.

@saxenakshitiz saxenakshitiz requested a review from a team as a code owner December 24, 2021 05:27
@codecov
Copy link

codecov bot commented Dec 24, 2021

Codecov Report

Merging #123 (021112a) into main (3cddf21) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #123   +/-   ##
=========================================
  Coverage     22.98%   22.98%           
  Complexity       75       75           
=========================================
  Files            65       65           
  Lines          1679     1679           
  Branches         52       52           
=========================================
  Hits            386      386           
  Misses         1284     1284           
  Partials          9        9           
Flag Coverage Δ
unit 22.98% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cddf21...021112a. Read the comment docs.

@github-actions

This comment has been minimized.

return getUpdatedLabels(labelResultSet).flatMap(responseConverter::convert);
}

private Single<List<Label>> getUpdatedLabels(LabelResultSet labelResultSet) {
Copy link
Contributor

Choose a reason for hiding this comment

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

To my earlier point, using the joiner in place of the DAO is what leads to this strange fetch, build response then update pattern. Ideally, we're doing the entity joining before constructing the label response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since dao returns a result set, you need to something similar isn't it? Even in entity joiner, entity dao returns entity result set which is then converted to a table and then back to appropriate result set.

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld Dec 27, 2021

Choose a reason for hiding this comment

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

in the current model, some other dao (say, label), would use the joiner when constructing its objects (labels). The entity joiner calls the entity dao and presents the results. Right now, that means its unpacking the result set into a table, and in the version we have here you may need to unpack and repack the result sets. Ideally that's not necessary and we can use them as is, but I think that may be required to enforce limits that differ.

Edit: the unpack/repack will always be needed on entity results - I keep forgetting that we have a different entity schema here.

@github-actions

This comment has been minimized.

}

@Override
public CompletableFuture<LabelResultSet> get(DataFetchingEnvironment environment) {
return this.requestBuilder
.build(environment.getContext(), environment.getSelectionSet())
.flatMap(request -> request.joinLabelsWithEntities())
.flatMap(request -> request.joinLabelsWithEntitiesAndRules())
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it doesn't really matter, but this is that inversion discussed elsewhere - the joiner is wrapping the dao rather than the dao wrapping the joiner. Since the DAO is an abstraction over where the data comes from, joiner in my mind is an implementation detail.

@github-actions

This comment has been minimized.

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld left a comment

Choose a reason for hiding this comment

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

fine to merge as is, we can continue discussion joiner/dao inversion comment and fix in followup if necessary.

@saxenakshitiz saxenakshitiz merged commit 6c8f5e0 into main Dec 27, 2021
@saxenakshitiz saxenakshitiz deleted the labels_associated_entities_count_part2 branch December 27, 2021 20:10
@github-actions
Copy link

Unit Test Results

11 files  ±0  11 suites  ±0   11s ⏱️ -3s
24 tests ±0  24 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 6c8f5e0. ± Comparison against base commit 3cddf21.

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