-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
4002 prevent user from creating twice the same blocklist item #5213
4002 prevent user from creating twice the same blocklist item #5213
Conversation
…me-blocklist-item
@@ -62,7 +62,7 @@ export interface UpdateManyResolverArgs< | |||
Filter = any, | |||
> { | |||
filter: Filter; | |||
data: Data; | |||
data: Data[]; |
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.
data should not be an array here, this is how we use it
{
"filter": {"id": {"in": ["something", "something-else"]}},
"data": {
"name": "eae"
}
}
where data is the shape of what you want to update against all the records that match with the filters
|
||
assertMutationNotOnRemoteObject(objectMetadataItem); | ||
assertIsValidUuid(args.data.id); | ||
for (const record of args.data) { | ||
assertIsValidUuid(record.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.
This was already wrong before but we don't want to check the id from data here but from the filter object. In fact, we should reject / not return id in the data type because we don't want to allow update of the ids in an updateMany (nor in an updateOne but for the updateMany won't even work due to unicity constraint)
FYI @charlesBochet @magrinj
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! 👏 @bosiraphael
Closes #4002