Skip to content

Commit 8598e34

Browse files
committed
Allow prismaFilters to filter for null values with equals, is, and isNot
1 parent 3e89a51 commit 8598e34

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/silent-wasps-sell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@pothos/plugin-prisma-utils': patch
3+
---
4+
5+
Allow filters to set null for equals, is and isNot

packages/plugin-prisma-utils/src/schema-builder.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const PrismaStringFilterModeRefMap = new WeakMap<
4545
EnumRef<'default' | 'insensitive'>
4646
>();
4747

48+
const nullableOps = ['equals', 'is', 'isNot'];
49+
4850
schemaBuilder.prismaFilter = function prismaFilter<
4951
Type extends InputType<SchemaTypes>,
5052
Ops extends OpsOptions<SchemaTypes, Type, FilterOps>,
@@ -70,7 +72,7 @@ schemaBuilder.prismaFilter = function prismaFilter<
7072
...options,
7173
extensions: {
7274
...options.extensions,
73-
pothosPrismaInput: true,
75+
pothosPrismaInput: { nullableFields: nullableOps },
7476
},
7577
fields: (t) => {
7678
const fields: Record<string, InputFieldRef<unknown, 'InputObject'>> = {};

0 commit comments

Comments
 (0)