Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

#patch Allow unscoped filtering on all NamedEntity(Metadata) fields #124

Merged
merged 3 commits into from
Sep 8, 2020

Conversation

schottra
Copy link
Contributor

@schottra schottra commented Sep 8, 2020

This fixes a regression where attempting to filter the list endpoint for NamedEntities on any of the base fields (such as name) will incorrectly exclude any records which do not have a metadata entry.

This is due to the generated query containing a where clause pointing at the metadata table, instead of the primary table.
For NamedEntitiy objects, the behavior we want is that the core and metadata fields are treated all as a single struct. The fact that we store the metadata in a separate table shouldn't require that filters be scoped.

This fixes the issue by leveraging some customization logic we already have for execution fields, but allows replacing of the filter entity instead. For state and description, we want the filter to be against the NamedEntityMetadata type. For all others, we want to use NamedEntity.

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2020

Codecov Report

Merging #124 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #124      +/-   ##
==========================================
+ Coverage   62.24%   62.26%   +0.02%     
==========================================
  Files         105      105              
  Lines        7840     7845       +5     
==========================================
+ Hits         4880     4885       +5     
  Misses       2385     2385              
  Partials      575      575              
Flag Coverage Δ
#unittests 62.26% <100.00%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
pkg/manager/impl/util/filters.go 71.54% <ø> (ø)
pkg/repositories/gormimpl/common.go 60.71% <ø> (ø)
pkg/common/filters.go 76.38% <100.00%> (+0.84%) ⬆️
pkg/manager/impl/named_entity_manager.go 40.69% <100.00%> (ø)

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 6e2c136...74aaf31. Read the comment docs.

@schottra schottra merged commit fab4226 into master Sep 8, 2020
@schottra schottra deleted the fix-entity-filtering branch September 8, 2020 20:35
schottra added a commit that referenced this pull request Sep 8, 2020
* origin/master:
  #patch Allow unscoped filtering on all NamedEntity(Metadata) fields (#124)
  Put testdata together with test cases (#123)
eapolinario pushed a commit that referenced this pull request Sep 6, 2023
…124)

* allow unscoped filtering for all named entity/metadata fields

* add comment

* adding test for entity replacement
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants