-
Notifications
You must be signed in to change notification settings - Fork 28
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
connect in update mutation #46
Comments
It seems that nexus-plugin-prisma removes relation id(in this case, shopId) from update mutation when building crud. If this is intended, I think ReferenceInput should be automatically changed to use 'create/connect'. Or, it would be nice if there was an option to use the shopId of source for query and shop.connect.id for mutation. Like this, <ReferenceInput label="Shop" source="shopId" sourceOut="shop.connect.id" reference="Shop">
<SelectInput optionText="name" />
</ReferenceInput> |
marmelab/react-admin#5608 (comment) I got this answer, can you guys fix it? |
@gtolarc did you try
? that should convert it to |
This is my schema.prisma model Shop {
@@map(name: "shop")
id Int @id @default(autoincrement())
name String?
itemInfos ItemInfo[]
}
model ItemInfo {
@@map(name: "itemInfo")
id Int @id @default(autoincrement())
name String?
shopId Int?
shop Shop? @relation(fields: [shopId], references: [id])
} and types const Shop = objectType({
name: 'Shop',
definition(t) {
t.model.id();
t.model.name();
t.model.itemInfos();
},
});
const ItemInfo = objectType({
name: 'ItemInfo',
definition(t) {
t.model.id();
t.model.name();
t.model.shopId();
t.model.shop();
},
}); |
lib vers. {
"dependencies": {
"@nexus/schema": "^0.19.2",
"@prisma/client": "^2.12.1",
"@ra-data-prisma/backend": "^4.0.0",
"graphql": "^15.4.0",
"nexus-plugin-prisma": "^0.25.0",
},
"devDependencies": {
"@prisma/cli": "^2.12.1",
}
} |
Yes, this is my related code. There seems to be a part where I made a mistake, but I don't know where it is. There seems to be no problem with the points you gave me. const schema = makeSchema({
types: [
Shop,
addCrudResolvers('Shop'),
ItemInfo,
addCrudResolvers('ItemInfo'),
],
plugins: [
nexusPrisma({
experimentalCRUD: true,
paginationStrategy: 'prisma',
outputs: {
typegen: path.resolve(__dirname, 'generated/nexus-prisma.d.ts'),
},
}),
],
outputs: {
typegen: path.resolve(__dirname, 'generated/nexus.d.ts'),
schema: path.resolve(__dirname, 'generated/schema.gql'),
},
}); |
@gtolarc no worries, maybe i am also wrong. I'll try to reproduce it in the project |
you do not seem to use the dataprovider, you need to use |
Sorry for the confusion. The version mentioned above is what I used in the backend, and I used @ra-data-prisma/dataprovider in the front as well. |
@gtolarc be aware that the latest supported version of nexus-plugin-prisma is 0.18.2. support for 0.25. is planned, but i had not had the chance to do it yet. a short test shows that its not compatible yet |
🎉 This issue has been resolved in version 5.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thank you! Awesome! @macrozone |
@gtolarc can you check if it works? |
Sure, it's working properly. @macrozone |
ReferenceInput is not automatically converted to 'connect' format. If source="shop.connect.id" is used, it works functionally, but the existing shopId is not recognized in the edit screen.
Is there a solution to this?
The text was updated successfully, but these errors were encountered: