Description and expected behavior
When trying to create and connect an object, in the same operation, which has the following policy:
@@allow('read,update', auth() != null && parents?[id == auth().id])
The create fails with a model not updatable error:
ORMError: many-to-many relation participant model "Child" not updatable
The read back should succeed though, as the parent would be connected as part of the operation:
const child = await authedClient.child.create({
data: {
name: "Child",
parents: {
connect: { id: userId },
},
},
});
Environment:
- ZenStack version: 3.5.2
- Database type: Postgres / SQLite
- Node.js version: 24.11.1
- Package manager: npm
Additional context
There's a reproduction repo here: https://github.com/f8k8/ZenstackConnectPermissionIssue
Running npm install will install the dependencies and seed the database, then run npm run start to see the error.
Description and expected behavior
When trying to create and connect an object, in the same operation, which has the following policy:
@@allow('read,update', auth() != null && parents?[id == auth().id])The create fails with a model not updatable error:
ORMError: many-to-many relation participant model "Child" not updatableThe read back should succeed though, as the parent would be connected as part of the operation:
Environment:
Additional context
There's a reproduction repo here: https://github.com/f8k8/ZenstackConnectPermissionIssue
Running
npm installwill install the dependencies and seed the database, then runnpm run startto see the error.