SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.26k stars 667 forks source link

[Bug]: Filtering boolean values crashes Prisma #1429

Open MarcinZmudka opened 1 year ago

MarcinZmudka commented 1 year ago

Contact Details

@MarcinZmudka on AdminJS slack

What happened?

I am using prisma and nest.js and have boolean values for disabled property. When using filter I can select Yes,No and clear value. After clearing value AdminJS is looking for record with disabled equal null and prisma throws an error.

Steps to reproduce:

  1. Open Filters
  2. Select "Yes"
  3. Click cross to clear value
  4. Click "Apply Changes"

Result:

Bug prevalence

always

AdminJS dependencies version

{ "dependencies": { "@adminjs/express": "^5.1.0", "@adminjs/nestjs": "^5.1.0", "@adminjs/prisma": "^3.0.1", "@nestjs/swagger": "^6.0.5", "@prisma-spectrum/reflector": "0.15.4", "@prisma/client": "4.7.1", "adminjs": "^6.8.2", "prisma": "4.7.1", "ts-node": "^10.0.0", "typescript": "^4.9.4", }

What browsers do you see the problem on?

Chrome

Relevant log output

[Nest] 471  - 02/21/2023, 11:11:39 AM   ERROR Error:
 Invalid `prisma.user.count()` invocation:

 {
   select: {
     _count: {
       select: {
         _all: true
       }
     }
   },
   where: {
     disabled: null
               ~~~~
   }
 }

 Argument disabled for where.disabled must not be null. Please use undefined instead.

Relevant code that's giving you issues

No response

effectivetom commented 1 year ago

This is a duplicate of https://github.com/SoftwareBrothers/adminjs/issues/1407.