Skip to content

Commit 9c43e8c

Browse files
committed
refactor(profile): added profile registration functionality through registration
1 parent ab78560 commit 9c43e8c

File tree

1 file changed

+16
-0
lines changed
  • apps/jobboard-backend/src/main/java/org/bounswe/jobboardbackend/auth/service

1 file changed

+16
-0
lines changed

apps/jobboard-backend/src/main/java/org/bounswe/jobboardbackend/auth/service/AuthService.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.bounswe.jobboardbackend.auth.security.JwtUtils;
1515
import org.bounswe.jobboardbackend.exception.ErrorCode;
1616
import org.bounswe.jobboardbackend.exception.HandleException;
17+
import org.bounswe.jobboardbackend.profile.model.Profile;
18+
import org.bounswe.jobboardbackend.profile.repository.ProfileRepository;
1719
import org.springframework.beans.factory.annotation.Value;
1820
import org.springframework.security.authentication.AuthenticationManager;
1921
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -45,6 +47,7 @@ public class AuthService {
4547
private final OtpService otpService;
4648
private final OtpRepository otpRepository;
4749
private final UserDetailsServiceImpl userDetailsService;
50+
private final ProfileRepository profileRepository;
4851

4952

5053

@@ -141,6 +144,19 @@ public MessageResponse registerAndSendVerification(@Valid RegisterRequest regist
141144
newUser.setRole(role);
142145
newUser.setEmailVerified(!appEnv.equals("prod"));
143146
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+
144160
if (appEnv.equals("prod")) {
145161
sendEmailForRegister(newUser);
146162
}

0 commit comments

Comments
 (0)