-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: Allow mutation of col sources via PatchCollection #2424
feat: Allow mutation of col sources via PatchCollection #2424
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2424 +/- ##
===========================================
- Coverage 74.85% 74.85% -0.00%
===========================================
Files 268 268
Lines 25875 25928 +53
===========================================
+ Hits 19367 19406 +39
- Misses 5183 5192 +9
- Partials 1325 1330 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
newColSources := newCol.CollectionSources() | ||
oldColSources := oldCol.CollectionSources() | ||
|
||
if len(newColSources) != len(oldColSources) { | ||
return NewErrCollectionSourcesCannotBeAddedRemoved(newCol.ID) | ||
} | ||
|
||
for i := range newColSources { | ||
if newColSources[i].SourceCollectionID != oldColSources[i].SourceCollectionID { | ||
return NewErrCollectionSourceIDMutated( | ||
newCol.ID, | ||
newColSources[i].SourceCollectionID, | ||
oldColSources[i].SourceCollectionID, | ||
) | ||
} | ||
} | ||
|
||
newQuerySources := newCol.QuerySources() | ||
oldQuerySources := oldCol.QuerySources() | ||
|
||
if len(newQuerySources) != len(oldQuerySources) { | ||
return NewErrCollectionSourcesCannotBeAddedRemoved(newCol.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: This validation is no longer doing what it was doing before. This means that the name is no longer accurate. Sources can be modified. We can't add or remove them or change their ID, be they can be modified. Maybe change the name to validateSourcesModification
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot, will do.
- Rename validation func
"firstName": "John", | ||
"lastName": "S" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: If you don't mind removing the extra spaces that would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A sign that I'm too reliant on my IDE to do this for me...
- Fix spacing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving assuming the minor todo will be resolved. The tests are really nice in helping to visualize what's happening.
7e83991
to
2fae5b5
Compare
…k#2424) ## Relevant issue(s) Resolves sourcenetwork#2422 ## Description Allows the mutation of collection sources via `PatchCollection`. Users can now set view and migration Lens transforms, and update view queries via json patch. Validation is non-existant RE the Query struct, as it is in develop branch. An invalid config will result in errors when querying the view. I think we can improve on this later, this PR does however increase the likelihood of invalid view queries being constructed (by users). It also massively increases the exposure of the `client/request` package, which whilst already public, is quite poorly documented. Similar to validation, this PR increases the priority of documenting it.
Relevant issue(s)
Resolves #2422
Description
Allows the mutation of collection sources via
PatchCollection
.Users can now set view and migration Lens transforms, and update view queries via json patch.
Validation is non-existant RE the Query struct, as it is in develop branch. An invalid config will result in errors when querying the view. I think we can improve on this later, this PR does however increase the likelihood of invalid view queries being constructed (by users).
It also massively increases the exposure of the
client/request
package, which whilst already public, is quite poorly documented. Similar to validation, this PR increases the priority of documenting it.