How To Add, Delete, and Change The User Entity
The User entity is required in order for you to enable authentication on your service.
If you choose to create a service without authentication then the User entity will not be created.
Adding The User Entity
First, go into your service's Entities page.
Click on the Add Entity button in the top right hand corner.
User into the entity name text field and then click on the Create Entity button.
A popup will appear and give you additional context on restoring the User entity. Click on the Restore Default button and the original User entity provided by Amplication will be restored.
You have to add the User entity first and then enable the NestJS Auth Module plugin. If you try to install the auth plugin first without the User entity, you will be offered to create it.
Deleting The User Entity
Usually, it's possible to delete any Entity that you create on your service. But, the User entity is special. In order to delete it, you must first disable the NestJS Auth Module.
It's possible to restore the original User entity provided by Amplication, but any additional fields or permissions you added will be permanently deleted.
Follow these steps to delete the User entity:
- Visit your service's Plugins page and toggle the NestJS Auth Module into the off state.
- Visit your service's Entities page. You will notice that you can now click the User entity's delete button. Click it and a popup will appear.
- Click on the popup's Delete button. Now the User entity is deleted.
Changing The Default User Entity
Amplication also gives you the ability to change the default User entity for each service.
Follow these steps to change the default User entity:
- Go to your service's Settings.
- Go to the Authentication Entity page.
- Pick the new Entity you want to be the User entity from the Entity List dropdown.
- You have now set a new User entity.