From cad366bf618c54545acf2197981852055504099c Mon Sep 17 00:00:00 2001 From: chenzn1 <312073339@qq.com> Date: Thu, 2 Nov 2023 11:05:19 +0800 Subject: [PATCH 1/3] feat: allow prismaFilters to filter for null values with not --- packages/plugin-prisma-utils/src/schema-builder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-prisma-utils/src/schema-builder.ts b/packages/plugin-prisma-utils/src/schema-builder.ts index 9dd47203b..24c798af0 100644 --- a/packages/plugin-prisma-utils/src/schema-builder.ts +++ b/packages/plugin-prisma-utils/src/schema-builder.ts @@ -45,7 +45,7 @@ const PrismaStringFilterModeRefMap = new WeakMap< EnumRef<'default' | 'insensitive'> >(); -const nullableOps = new Set(['equals', 'is', 'isNot']); +const nullableOps = new Set(['equals', 'is', 'isNot', 'not']); schemaBuilder.prismaFilter = function prismaFilter< Type extends InputType, From cfb3f9ea9d7c7fade67855dc07b68d2f4487ac8f Mon Sep 17 00:00:00 2001 From: chenzn1 <312073339@qq.com> Date: Mon, 6 Nov 2023 13:56:00 +0800 Subject: [PATCH 2/3] fix(tests): posts --- packages/plugin-prisma-utils/tests/index.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/plugin-prisma-utils/tests/index.test.ts b/packages/plugin-prisma-utils/tests/index.test.ts index dce84761a..9b1bed88d 100644 --- a/packages/plugin-prisma-utils/tests/index.test.ts +++ b/packages/plugin-prisma-utils/tests/index.test.ts @@ -24,7 +24,7 @@ describe('prisma utils', () => { query { posts( order: { author: { name: Desc, profile: null } } - filter: { id: { not: { equals: 11, not: null } } } + filter: { id: { not: { equals: 11 } } } ) { id author { @@ -86,7 +86,6 @@ describe('prisma utils', () => { "id": { "not": { "equals": 11, - "not": undefined, }, }, }, From 4a11ce041746c83b072bde5f1e360a254e431d3a Mon Sep 17 00:00:00 2001 From: chenzn1 <312073339@qq.com> Date: Mon, 6 Nov 2023 14:25:17 +0800 Subject: [PATCH 3/3] add changeset --- .changeset/small-ads-cover.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/small-ads-cover.md diff --git a/.changeset/small-ads-cover.md b/.changeset/small-ads-cover.md new file mode 100644 index 000000000..2bd34fdaa --- /dev/null +++ b/.changeset/small-ads-cover.md @@ -0,0 +1,5 @@ +--- +'@pothos/plugin-prisma-utils': minor +--- + +Allow filters to set null for not