Skip to content

Commit

Permalink
fix: 강제 회원가입 기능 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gutanbug committed Dec 18, 2023
1 parent 1edb0a0 commit e2d6a17
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import com.dku.council.domain.user.exception.AlreadyPhoneException;
import com.dku.council.domain.user.exception.AlreadyStudentIdException;
import com.dku.council.domain.user.exception.MajorNotFoundException;
import com.dku.council.domain.user.model.UserStatus;
import com.dku.council.domain.user.model.entity.Major;
import com.dku.council.domain.user.model.entity.User;
import com.dku.council.domain.user.repository.MajorRepository;
import com.dku.council.domain.user.repository.UserRepository;
import com.dku.council.global.auth.role.UserRole;
import com.dku.council.global.error.exception.UserNotFoundException;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -55,7 +57,9 @@ public void addUser(@RequestParam String studentId,
@RequestParam String nickname,
@RequestParam Long majorId,
@RequestParam Integer yearOfAdmission,
@RequestParam String phone) {
@RequestParam String phone,
@RequestParam String age,
@RequestParam String gender) {
if (userRepository.findByStudentId(studentId).isPresent()) {
throw new AlreadyStudentIdException();
}
Expand All @@ -78,10 +82,14 @@ public void addUser(@RequestParam String studentId,
.password(encryptedPassword)
.name(name)
.nickname(nickname)
.age(age)
.gender(gender)
.major(major)
.yearOfAdmission(yearOfAdmission)
.academicStatus("재학")
.phone(phone)
.status(UserStatus.ACTIVE)
.role(UserRole.USER)
.build();

userRepository.save(user);
Expand Down

0 comments on commit e2d6a17

Please sign in to comment.