-
Notifications
You must be signed in to change notification settings - Fork 33
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
How to add a prisma relation to a response? #20
Comments
Hello It seems that kind of option is not part of the But for what you want to do, a simple solution would be to create your own adapter that extends the Prisma one, and override the class MyPrismaAdapter extends PrismaAdapter {
parseQuery(query) {
const parsed = super.parseQuery(query)
parsed.select = {
...parsed.select,
users: true
}
}
} Let me know if that fixes your issue |
Hi! How can I add a relation when creating a new record? This is an example. model Article { When I create a new Article I want to add a relation with a Category. What do I have to send in the request body? Thanks! |
Hello, The adapter accepts whatever data you are passing in the request body. So basically, you can send whatever prisma accepts in the https://github.com/premieroctet/next-crud/blob/master/src/adapters/prisma/index.ts#L183 |
Hi! How can I add a relation to a response? I have the following code but the users doesn't get returned:
The text was updated successfully, but these errors were encountered: