[ORM] CreateRelationField typing is missing when creating a delegated Model from a polymorphic Model
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
- Lĩnh vực
- database
Hướng nghiên cứu
Reproduce with the example schema: Main carrying @@delegate(type) and Sub extends Main, then inspect the generated typing for zenstack.sub.create and check where CreateRelationField should be applied to the inherited item and the Sub-only group. The generator that expands delegate/polymorphic models and their relations produces these types; compare what it emits for Sub against a non-delegated model with the same relations. Done means db.sub.create({ data: { item, group } }) exposes the usual connect/create relation fields with correct types. The payload names no file, so locating the type-generation code is part of the work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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, ...
- Ngôn ngữ chính
- TypeScript
- Star
- 2.9k
- Fork
- 157
- Merge trung bình
- 4 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của zenstackhq/zenstack
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
zenstackhq/zenstack#2873 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@default` on a field of a `@map`-ed enum emits the enum name as the column defaultCó thể làm lại được @jkugsiya đã nhận 12 ngày trước và không có pull request nào đang mở. Đang mởruntime
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
zenstackhq/zenstack#2868 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
zenstackhq/zenstack#2694 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
zenstackhq/zenstack#2659 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
zenstackhq/zenstack#2542 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của zenstackhq/zenstack
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
grafana/profiles-drilldown#1212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
grafana/traces-drilldown#980 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Manager flashes an empty "errorOccurred" dialog while redirecting a logged-out user to loginĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openremote/openremote#3487 · 1 bình luận ·
-
triage:needs-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
garrytan/gbrain#7635 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
coollabsio/jean#867 ·
Maintainer thường phản hồi trong vòng 1 ngày