-
Notifications
You must be signed in to change notification settings - Fork 51
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
fix: Prevent multiple docs from being linked in one one #1790
fix: Prevent multiple docs from being linked in one one #1790
Conversation
Codecov ReportPatch coverage:
@@ Coverage Diff @@
## develop #1790 +/- ##
===========================================
- Coverage 75.88% 75.69% -0.19%
===========================================
Files 209 209
Lines 22106 22213 +107
===========================================
+ Hits 16774 16812 +38
- Misses 4183 4233 +50
- Partials 1149 1168 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
7e77e0f
to
95e1f72
Compare
95e1f72
to
6793ab9
Compare
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.
LGTM
@@ -600,3 +602,12 @@ func NewErrDocCreate(inner error) error { | |||
func NewErrDocUpdate(inner error) error { | |||
return errors.Wrap(errDocUpdate, inner) | |||
} | |||
|
|||
func NewErrOneOneAlreadyLinked(documentId, targetId, relationName string) error { |
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: rename to documentID
, targetID
This is a concerningly inefficient approach here. This should very much be refactored once #298 is completed, where each relation gets its own unique index. This would be analgeous to an SQL foreign key unique constraint. It will ofc be a space/time tradeoff, indexes using more space, but will turn this operation into an O(1) instead of O(n), at the cost of O(n) space. This tradeoff can be exposed via the Eg. type Author {
name: String
book: Book @relation(index: false) # by default this would be (index: true)
} |
really@@hi |
…k#1790) ## Relevant issue(s) Resolves sourcenetwork#1646 ## Description Prevents multiple docs from being linked in one one. It does this by scanning if from primary, or a point-lookup if from secondary. By going via the `Fetcher` interface and `newFetcher` func this should respect Lens, and any indexes once the are implemented. A handful of import/export tests got removed as they would no longer have anything to do with import/export once corrected (the error occurs before that action).
Relevant issue(s)
Resolves #1646
Description
Prevents multiple docs from being linked in one one.
It does this by scanning if from primary, or a point-lookup if from secondary. By going via the
Fetcher
interface andnewFetcher
func this should respect Lens, and any indexes once the are implemented.A handful of import/export tests got removed as they would no longer have anything to do with import/export once corrected (the error occurs before that action).