Description and expected behavior
When wanting to create a new model with the create or createMany methods on a submodel of a delegated model (so Main has the @@delegate and Sub is a delegate of Main and you want to create a Sub entity) and this sub model has a relation the usual CreateRelationField typing is missing on all relation fields and only will be undefined.
Environment (please complete the following information):
- ZenStack version: 3.8.3
- Database type: PostgreSQL
- Node.js/Bun version: 1.3.14
- Package manager: Bun
Example schema
model Main with Base {
item Item @relation(fields: [itemId], references: [id], onDelete: Cascade)
itemId String
@@unique([permissionId, itemId])
@@delegate(type)
}
model Sub extends Main {
group Group @relation(fields: [groupId], references: [id], onDelete: Cascade)
groupId String
}
and then creating a Sub via zenstack.sub.create:
await db.sub.create({
data: {
item: // <-- this is undefined and untyped
group: // <-- aswell as relation lying directly on the Sub
},
})
usually there will be functions like connect, create, ...
Description and expected behavior
When wanting to create a new model with the
createorcreateManymethods on a submodel of a delegated model (soMainhas the@@delegateandSubis a delegate ofMainand you want to create aSubentity) and this sub model has a relation the usualCreateRelationFieldtyping is missing on all relation fields and only will beundefined.Environment (please complete the following information):
Example schema
model Main with Base { item Item @relation(fields: [itemId], references: [id], onDelete: Cascade) itemId String @@unique([permissionId, itemId]) @@delegate(type) } model Sub extends Main { group Group @relation(fields: [groupId], references: [id], onDelete: Cascade) groupId String }and then creating a
Subviazenstack.sub.create:usually there will be functions like
connect,create, ...