Skip to content

Commit

Permalink
Merge pull request #1079 from chenzn1/feature/prisma-filters
Browse files Browse the repository at this point in the history
feat: allow prismaFilters to filter for null values with not
  • Loading branch information
hayes authored Nov 6, 2023
2 parents 5516d38 + 4a11ce0 commit cb4afca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-ads-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pothos/plugin-prisma-utils': minor
---

Allow filters to set null for not
2 changes: 1 addition & 1 deletion packages/plugin-prisma-utils/src/schema-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SchemaTypes>,
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin-prisma-utils/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -86,7 +86,6 @@ describe('prisma utils', () => {
"id": {
"not": {
"equals": 11,
"not": undefined,
},
},
},
Expand Down

1 comment on commit cb4afca

@vercel
Copy link

@vercel vercel bot commented on cb4afca Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.