|
|
@@ -101,6 +101,15 @@ public class UserService {
|
|
|
}).orElseThrow(CustomErrorException::userIdNotFound);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = RuntimeException.class)
|
|
|
+ public void updateRole(String phone, UserRole role) {
|
|
|
+ userRepository.findByPhone(phone)
|
|
|
+ .map(user -> {
|
|
|
+ user.setRole(role);
|
|
|
+ return userRepository.save(user);
|
|
|
+ }).orElseThrow(() -> CustomErrorException.userPhoneNotFound(phone));
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackFor = RuntimeException.class)
|
|
|
public User registerUser(UserVO userVO, String password, String phoneCode) {
|
|
|
checkPhoneMessageOrThrowError(userVO.getPhone(), phoneCode);
|