premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
293 stars 13 forks source link

[FEATURE] - Add support for an Advanced Search #346

Closed malaney closed 1 month ago

malaney commented 3 months ago

Summary

Currently next-admin supports searching against a single string input across numerous fields, which is great. But often times our admin panels require search across multiple conditions with multiple data types. For example:

const result = await prisma.post.findMany({
  where: {
    AND: [
      {
        content: {
          contains: 'Prisma',
        },
      },
      {
        published: {
          equals: false,
        },
      },
    ],
  },
})

Could we add support for an Advanced Search that allows users to define search fields (i.e. "content" and "published") as well as data types (i.e. "string" and "boolean") and perhaps even a comparator (i.e. lt, gt, lte, gte, etc ...).

Thank you for considering this. Next-Admin is outstanding!!

Basic Example

As a user I'd like to be able to narrow the Posts results down to entries by author "Morrison" published after "2016".

Drawbacks

Can't think of any real drawbacks. But the advanced search would most likely need to appear in a new modal and that may be tricky for mobile first designs.

Unresolved questions

No response

foyarash commented 3 months ago

Hello

Thank you for the issue, this is something that is in the pipeline, we are thinking about how to implement it in the best possible way. A first step to this was to add the custom filters property. Next step is to add a more complex query builder which should fit any use case for the queries

foyarash commented 3 months ago

This is actually related to #326

foyarash commented 1 month ago

Closing in favor of #326