Step1: Create the three pakages entities, enum, and repository.
Step2:inside the entities folder create the class User
AttendanceServer.entities.User.java
@Entity @Data public class User {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;
private String email;
private String password;
private String name;
private UserRole userRole;
}
Step3:inside the Enum folder create the UserRole.
AttendanceServer/enums/UserRole.java
public enum UserRole {
ADMIN, MANAGER, EMPLOYE }
Step4:inside the repository folder create the interface Repository.
Output:- Run the application and check Table created successfully.
Now we can create the Auth Service.
Step4:Now we can created the role of Admin.
Step1: we will create auth service and then we will create a method to find the user by role in the user repository and at the end we will create a method to automatically create admin user.
No comments:
Post a Comment
If you have any problem please let me know.