premieroctet / next-admin

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

feat: Add where in options #487

Closed didrikmunther closed 1 week ago

didrikmunther commented 1 week ago

Title

[Provide a succinct and descriptive title for the pull request, e.g., "Improve caching mechanism for API calls"]

Type of Change

Description

I have a use case for adding multi-tenancy to this admin panel, and I need to be able to set dynamic where clauses to filter on a users organization id.

Screenshots

CleanShot 2024-11-16 at 00 29 49

Testing

No tests have been written for this.

Impact

This should open up for more advanced admin panels.

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 36bb9da2696dade7a19365b2b91537dcdab17b4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------------ | ----- | | @premieroctet/next-admin | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

cregourd commented 1 week ago

Hi @didrikmunther, First of all, thanks for your PR However, note that this may be a bit ambiguous for users to have a partial list of data without seeing any filter applied. Wouldn't you want to use filters options with active: true instead, to keep a visual representation of applied filters in the list that users see?

didrikmunther commented 1 week ago

Hi @didrikmunther, First of all, thanks for your PR However, note that this may be a bit ambiguous for users to have a partial list of data without seeing any filter applied. Wouldn't you want to use filters options with active: true instead, to keep a visual representation of applied filters in the list that users see?

Hi @cregourd, The reason is because I'm building a multi-tenancy app, where users should not even know about the internals of the organization-scoping mechanisms. E.g. in Google Calendar, I don't see any active filters that calendar id "xxxx" and "yyyy" is activated, it just automatically filters such that I can only see my own calendars.