Skip to content

Commit 88862bd

Browse files
committed
fix: New names when combineScalarFilters enabled
1 parent 81fe35f commit 88862bd

File tree

6 files changed

+257
-234
lines changed

6 files changed

+257
-234
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ Default: `@prisma/client`
7878

7979
#### `combineScalarFilters`
8080

81-
DOESNT WORK IN v21+
82-
8381
Combine nested/nullable scalar filters to single
8482
Type: `boolean`
8583
Default: `false`
@@ -764,3 +762,4 @@ import { generate } from 'prisma-nestjs-graphql/generate';
764762
765763
- keyof typeof SortOrder -> `SortOrder`
766764
- dummy-createfriends.input.ts -> `create-friends`
765+
- check 'TODO FIXME'

Taskfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ compatibilty_check() {
3030
rm -rf ./@generated && npm run prisma:g && npm run tscheck
3131
sed -i 's/noAtomicOperations *= true/noAtomicOperations = false/g' prisma/schema.prisma
3232

33-
# echo === Check combineScalarFilters ===
34-
# sed -i 's/combineScalarFilters *= false/combineScalarFilters = true/g' prisma/schema.prisma
35-
# rm -rf ./@generated && npm run prisma:g && npm run tscheck
36-
# sed -i 's/combineScalarFilters *= true/combineScalarFilters = false/g' prisma/schema.prisma
33+
echo === Check combineScalarFilters ===
34+
sed -i 's/combineScalarFilters *= false/combineScalarFilters = true/g' prisma/schema.prisma
35+
rm -rf ./@generated && npm run prisma:g && npm run tscheck
36+
sed -i 's/combineScalarFilters *= true/combineScalarFilters = false/g' prisma/schema.prisma
3737

3838
echo === Switching reExport ===
3939
sed -i 's/reExport *= None/reExport = All/g' prisma/schema.prisma

src/handlers/combine-scalar-filters.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,13 @@ function postBegin(args: EventArguments) {
124124
]);
125125
}
126126

127-
remove(inputTypes, inputType => isContainBogus(inputType.name));
127+
for (const modelName of modelNames) {
128+
replaceBogusFilters(`${modelName}ScalarRelationFilter`, [
129+
`${modelName}NullableScalarRelationFilter`,
130+
]);
131+
}
132+
133+
remove(inputTypes, inputType => {
134+
return isContainBogus(inputType.name);
135+
});
128136
}

src/test/combine-scalar-filters.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ describe('combine scalar filters on array', () => {
236236
});
237237
});
238238

239-
describe.skip('empty relation filter input', () => {
240-
// TODO: Enable Check combineScalarFilters in Taskfile
239+
describe('empty relation filter input', () => {
241240
before(async () => {
242241
({ project, sourceFiles } = await testGenerate({
243242
options: [`combineScalarFilters = true`],

0 commit comments

Comments
 (0)