-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Issue: shield rule on model with WhereUniqueInput results in error #123
Comments
+1 I am having the same issue with @unique columns when connecting relationships. When I do: mutation UpsertfixtureEvent(
$dateTime: AWSDateTime
$eventTypeId: String!
$reason: String
$teamFixtureId: String!
$teamPlayerId: String
$teamPlayerOffId: String
$teamStaffId: String
$id: String!
) {
upsertFixtureEvent(
data: {
id: $id
dateTime: $dateTime
eventType: { connect: { id: $eventTypeId } }
reason: $reason
teamFixture: { connect: { id: $teamFixtureId } }
teamPlayer: { connect: { id: $teamPlayerId } }
teamPlayerOffId: $teamPlayerOffId
teamStaff: { connect: { id: $teamStaffId } }
}
where: { id: $id }
) {
id
}
}
My model looks like:
When I attempt to run this mutation, it complains that 'type' is not supplied for the connect on $eventTypeId. I have tried this as a @@unique and @unique on the property, but both have the same output. How can I connect a relationship where one of the columns has a unique key simply for data integrity and no for connecting? |
@maoosi I was wondering if it was worth me cloning this repo and potentially looking to resolve this as a collaborator, or does it tie in to a bigger story for you at the moment. We are using this package in our production application, and this is now blocking us on our latest release. I more than happy to play around, just don't want to waste any time if you are aligned to this or have specific sights on what the solution should look like specifically? |
@micklaw Happy for you to open a PR. I don't think the issue has anything to do with shield rules, but what suggested @jeremy-white is a good place to start:
We just need to make sure it still works with broader use cases and with the |
@micklaw all other tasks for the 1.0.0-rc.6 release milestone are ready, so I might be able to work on this issue sometime this week. Are you still wanting to contribute, or should I take this one over? |
Please take it over, I actually done some testing on my use case and could not duplicate the issue in your test suite, so I think my issue lies in my application code. Thank you. |
@jeremy-white I ended up implementing your suggested change. I noticed some edge cases for which Prisma Shield rules will not be able to merge automatically with the existing |
@all-contributors please add @jeremy-white for code. |
I've put up a pull request to add @jeremy-white! 🎉 |
Related to issue #87
In a new repository with Prisma-AppSync 1.0.0-rc.5 and Prisma 4.11.0
WIth the extendedWhereUnique preview feature enabled, a model defined as
and a shield rule of
executing the mutation
results in the error
As a quick test I've changed the code here
prisma-appsync/packages/client/src/resolver.ts
Line 34 in 1d9b0f1
to be
Which allows everything to work as far as I can tell so far, but I'm sure there may be a better way to address it.
Am willing to work on it further and open a PR if that would be of help
The text was updated successfully, but these errors were encountered: