|
14 | 14 | import org.bounswe.jobboardbackend.auth.security.JwtUtils; |
15 | 15 | import org.bounswe.jobboardbackend.exception.ErrorCode; |
16 | 16 | import org.bounswe.jobboardbackend.exception.HandleException; |
| 17 | +import org.bounswe.jobboardbackend.profile.model.Profile; |
| 18 | +import org.bounswe.jobboardbackend.profile.repository.ProfileRepository; |
17 | 19 | import org.springframework.beans.factory.annotation.Value; |
18 | 20 | import org.springframework.security.authentication.AuthenticationManager; |
19 | 21 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
@@ -45,6 +47,7 @@ public class AuthService { |
45 | 47 | private final OtpService otpService; |
46 | 48 | private final OtpRepository otpRepository; |
47 | 49 | private final UserDetailsServiceImpl userDetailsService; |
| 50 | + private final ProfileRepository profileRepository; |
48 | 51 |
|
49 | 52 |
|
50 | 53 |
|
@@ -141,6 +144,19 @@ public MessageResponse registerAndSendVerification(@Valid RegisterRequest regist |
141 | 144 | newUser.setRole(role); |
142 | 145 | newUser.setEmailVerified(!appEnv.equals("prod")); |
143 | 146 | userRepository.save(newUser); |
| 147 | + |
| 148 | + Profile profile = Profile.builder() |
| 149 | + .user(newUser) |
| 150 | + .firstName(registerRequest.getFirstName()) |
| 151 | + .lastName(registerRequest.getLastName()) |
| 152 | + .bio(registerRequest.getBio()) |
| 153 | + .gender(registerRequest.getGender()) |
| 154 | + .imageUrl(null) |
| 155 | + .build(); |
| 156 | + |
| 157 | + profileRepository.save(profile); |
| 158 | + |
| 159 | + |
144 | 160 | if (appEnv.equals("prod")) { |
145 | 161 | sendEmailForRegister(newUser); |
146 | 162 | } |
|
0 commit comments