-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(delegate): several generation issues (#1417)
- Loading branch information
Showing
4 changed files
with
110 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
|
||
describe('issue 1415', () => { | ||
it('regression', async () => { | ||
await loadSchema( | ||
` | ||
model User { | ||
id String @id @default(cuid()) | ||
prices Price[] | ||
} | ||
model Price { | ||
id String @id @default(cuid()) | ||
owner User @relation(fields: [ownerId], references: [id]) | ||
ownerId String @default(auth().id) | ||
priceType String | ||
@@delegate(priceType) | ||
} | ||
` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
|
||
describe('issue 1416', () => { | ||
it('regression', async () => { | ||
await loadSchema( | ||
` | ||
model User { | ||
id String @id @default(cuid()) | ||
role String | ||
} | ||
model Price { | ||
id String @id @default(nanoid(6)) | ||
entity Entity? @relation(fields: [entityId], references: [id]) | ||
entityId String? | ||
priceType String | ||
@@delegate(priceType) | ||
} | ||
model MyPrice extends Price { | ||
foo String | ||
} | ||
model Entity { | ||
id String @id @default(nanoid(6)) | ||
price Price[] | ||
type String | ||
@@delegate(type) | ||
} | ||
model MyEntity extends Entity { | ||
foo String | ||
} | ||
` | ||
); | ||
}); | ||
}); |