Theodo-UK / nestjs-admin

A generic administration interface for TypeORM entities
https://nestjs-admin.com
MIT License
536 stars 60 forks source link

Example App - Group Name #153

Closed julian-iFactory closed 4 years ago

julian-iFactory commented 4 years ago

https://github.com/Theodo-UK/nestjs-admin/blob/5b33b27b18e4fd764c11f250764615861482bbbd/exampleApp/src/user/user.module.ts#L21

For creating an admin view for editing the Group Entity shouldn't it be:

adminSite.register('Group', Group)

Thank you for creating nestjs-admin its an important feature for a framework. It would be beneficial if the was a demo app in a separate repository - it would make it easier to understand how nestjs-admin is added into a pre-existing site.

williamdclt commented 4 years ago

The first argument is the name of the "section" the entity will be displayed in, in the index page of the admin interface (see screenshot). This is just a UI thing, allowing you to group entities together. Here the Group entity would be under the User section (alongside the User entity), but you're free to register it under any section you want.

image

This is here to be consistent with Django Admin where each entity ("model" in Django) is under a section ("app"). But this API probably doesn't make too much sense, this would be a better approach:

adminSite.register(Group, {sectionName: 'User'}) // second argument is some optional options bag 

I'll close this issue as this is working as expected (unless I misunderstood your issue). This API change is fairly low in my list of priorities, to be honest 🙂