Changeset 6032d44
- Timestamp:
- 02/04/23 19:01:47 (22 months ago)
- Branches:
- master
- Children:
- e097c1c
- Parents:
- 27adfc8
- Location:
- src/main
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/model/Customer.java
r27adfc8 r6032d44 25 25 Integer points; 26 26 27 // public Customer(String password, String first_name, String last_name, String address, String contact_number, String username) { 28 // super(password, first_name, last_name, address, contact_number, username); 29 // } 27 public Customer(String password, String first_name, String last_name, String address, String contact_number, String username) { 28 super(password, first_name, last_name, address, contact_number, username); 29 } 30 31 public Customer() { 32 33 } 30 34 31 35 @Override -
src/main/java/com/example/moviezone/model/Worker.java
r27adfc8 r6032d44 28 28 Cinema cinema; 29 29 30 // public Worker(String password, String first_name, String last_name, String address, String contact_number, String username) { 31 // super(password, first_name, last_name, address, contact_number, username); 32 // } 30 public Worker(String password, String first_name, String last_name, String address, String contact_number, String username) { 31 super(password, first_name, last_name, address, contact_number, username); 32 } 33 34 public Worker() { 35 36 } 33 37 34 38 @Override -
src/main/java/com/example/moviezone/service/Impl/UserServiceImpl.java
r27adfc8 r6032d44 38 38 } 39 39 40 // @Override 41 // public User register(String first_name, String last_name, String username, String email, String number, String password, String role) { 42 // if(role.equals("worker")) 43 // { 44 // return userRepository.save(new Worker(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 45 // } 46 // else if (role.equals("user")) 47 // return userRepository.save(new Customer(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 48 // } 40 @Override 41 public User register(String first_name, String last_name, String username, String email, String number, String password, String role) { 42 if(role.equals("worker")) 43 { 44 return userRepository.save(new Worker(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 45 } 46 else 47 return userRepository.save(new Customer(passwordEncoder.encode(password),first_name,last_name,username,email,number)); 48 } 49 50 @Override 51 public User login(String username, String password) { 52 return userRepository.findAllByUsernameAndPassword(username,password).stream().findFirst().orElseThrow(UserNotFoundException::new); 53 } 49 54 50 55 -
src/main/java/com/example/moviezone/service/UserService.java
r27adfc8 r6032d44 10 10 User findByUsername(String username); 11 11 12 //User register(String first_name, String last_name,String username, String email, String number, String password, String role);13 12 User register(String first_name, String last_name,String username, String email, String number, String password, String role); 13 User login(String username,String password); 14 14 } -
src/main/java/com/example/moviezone/web/HomeController.java
r27adfc8 r6032d44 24 24 } 25 25 26 26 27 27 28 }
Note:
See TracChangeset
for help on using the changeset viewer.