adminjs-prisma icon indicating copy to clipboard operation
adminjs-prisma copied to clipboard

searchRecords doesn't work with prisma

Open Malin88 opened this issue 2 years ago • 0 comments

When I use prisma adapter and I try to search through the records in my custom component in this way:

const promiseOptions = (inputValue: string, callback) => {
    if (!inputValue) {
      callback([]);
    } else {
      api
        .searchRecords({
          resourceId: 'Translation',
          query: inputValue,
        })
        .then((results) => {
          console.log(results);
        });
    }
  };

I get the following error:

Error: 
Invalid `prisma.translation.findMany()` invocation:

{
  where: {
    id: null
        ~~~~
  },
  skip: 0,
  take: 50,
  orderBy: {
    id: 'asc'
  }
}

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

Malin88 avatar May 11 '22 19:05 Malin88