Skip to content

Commit

Permalink
[fix] 회원가입 API 학번 및 가입일자 예외처리 추가 (CAUCSE#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
win-luck committed Jan 1, 2025
1 parent e3523c1 commit c9e4744
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/net/causw/application/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ public List<CircleResponseDto> getCircleList(User user) {
public UserResponseDto signUp(UserCreateRequestDto userCreateRequestDto) {
// Make domain model for generalized data model and validate the format of request parameter

// 학번 앞 4자리와 입학년도가 다른 경우 잘못된 요청이므로 예외처리
if (!userCreateRequestDto.getStudentId().substring(0, 4).equals(userCreateRequestDto.getAdmissionYear().toString())) {
throw new BadRequestException(
ErrorCode.INVALID_USER_DATA_REQUEST,
MessageUtil.INVALID_USER_DATA_REQUEST
);
}

this.userRepository.findByEmail(userCreateRequestDto.getEmail()).ifPresent(
email -> {
throw new BadRequestException(
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/causw/domain/model/util/MessageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class MessageUtil {
public static final String INVALID_TOKEN = "잘못된 AccessToken 입니다";
public static final String EXPIRED_TOKEN = "만료된 AccessToken 입니다";
public static final String DOES_NOT_HAVE_PERMISSION = "권한이 없습니다.";
public static final String INVALID_USER_DATA_REQUEST = "유저의 가입 및 수정 정보가 유효하지 않습니다.";

// Form
public static final String IS_NEED_COUNCIL_FEE_REQUIRED = "학생회비 납부 여부를 선택해 주세요.";
Expand Down

0 comments on commit c9e4744

Please sign in to comment.