Skip to content

Commit b4ac69b

Browse files
Add sample compound id model
1 parent be8c1c4 commit b4ac69b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/plugins/openapi/tests/openapi-restful.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ model User {
3535
role role @default(USER)
3636
posts post_Item[]
3737
profile Profile?
38+
likes PostLike[]
3839
}
3940
4041
model Profile {
@@ -55,12 +56,21 @@ model post_Item {
5556
published Boolean @default(false)
5657
viewCount Int @default(0)
5758
notes String?
59+
likes PostLike[]
5860
5961
@@openapi.meta({
6062
tagDescription: 'Post-related operations'
6163
})
6264
}
6365
66+
model PostLike {
67+
post post_Item @relation(fields: [postId], references: [id])
68+
postId String
69+
user User @relation(fields: [userId], references: [id])
70+
userId String
71+
@@id([postId, userId])
72+
}
73+
6474
model Foo {
6575
id String @id
6676
@@openapi.ignore

0 commit comments

Comments
 (0)