diff --git a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/Grade.java b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/Grade.java index 23fbd68a..89b81210 100644 --- a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/Grade.java +++ b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/Grade.java @@ -26,7 +26,7 @@ boolean validate(Object value) { if (Objects.isNull(value)) return true; if (!(value instanceof Integer)) return false; int o = (Integer) value; - return 1 <= o && o <= 5; // 1학년부터 5학년(초과학기)까지 가능, 0학년은 학생이 아닐때 + return 0 <= o && o <= 5; // 1학년부터 5학년(초과학기)까지 가능, 0학년은 학생이 아닐때 } } diff --git a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/SchoolInformation.java b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/SchoolInformation.java index 9014dd58..b5ba0333 100644 --- a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/SchoolInformation.java +++ b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/SchoolInformation.java @@ -37,6 +37,7 @@ public SchoolInformation(String major, Integer generation, MemberType memberType this.major = new Major(major); this.generation = new Generation(generation); this.memberType = memberType; + this.grade = new Grade(DEFAULT_GRADE); } diff --git a/module-auth/src/test/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/GradeTest.java b/module-auth/src/test/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/GradeTest.java index 3d1a7f48..ab94a006 100644 --- a/module-auth/src/test/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/GradeTest.java +++ b/module-auth/src/test/java/com/inhabas/api/auth/domain/oauth2/member/domain/valueObject/GradeTest.java @@ -28,9 +28,5 @@ public void No_Such_Grade() { IllegalArgumentException.class, () -> new Grade(-1) ); - assertThrows( - IllegalArgumentException.class, - () -> new Grade(0) - ); } } diff --git a/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java b/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java index 13d40265..1778ae21 100644 --- a/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java +++ b/resource-server/src/main/java/com/inhabas/api/config/WebSecurityConfig.java @@ -115,7 +115,7 @@ protected void configure(HttpSecurity http) throws Exception { .antMatchers("/lecture/**").hasRole(DEACTIVATED.toString()) // 회원가입 일정 수정 - .antMatchers(HttpMethod.PUT,"/signUp/schedule").hasRole(CHIEF.toString()) + .antMatchers(HttpMethod.PUT,"/signUp/schedule").hasAnyRole(CHIEF.toString(), VICE_CHIEF.toString()) // 회원가입은 ANONYMOUS 권한은 명시적으로 부여받은 상태에서만 가능 .antMatchers("/signUp/**").hasRole(SIGNING_UP.toString()) diff --git a/resource-server/src/main/java/com/inhabas/api/web/SignUpController.java b/resource-server/src/main/java/com/inhabas/api/web/SignUpController.java index f5665f63..42b5793d 100644 --- a/resource-server/src/main/java/com/inhabas/api/web/SignUpController.java +++ b/resource-server/src/main/java/com/inhabas/api/web/SignUpController.java @@ -1,10 +1,10 @@ package com.inhabas.api.web; import com.inhabas.api.auth.domain.oauth2.majorInfo.dto.MajorInfoDto; +import com.inhabas.api.domain.questionnaire.dto.QuestionnaireDto; import com.inhabas.api.domain.signUp.dto.AnswerDto; import com.inhabas.api.domain.signUp.dto.SignUpDto; import com.inhabas.api.domain.signUp.usecase.SignUpService; -import com.inhabas.api.domain.questionnaire.dto.QuestionnaireDto; import com.inhabas.api.web.argumentResolver.Authenticated; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -108,7 +107,7 @@ public ResponseEntity> loadAnswers(@Authenticated Long memberId) @PostMapping("/signUp/answers") @Operation(summary = "회원가입 시 자신이 작성한 답변을 임시 저장한다.") @ApiResponses({ - @ApiResponse(responseCode = "204"), + @ApiResponse(responseCode = "200"), @ApiResponse(responseCode = "400", description = "답변이 길이제한을 초과했을 경우"), @ApiResponse(responseCode = "403", description = "권한이 없습니다.") }) @@ -117,7 +116,7 @@ public ResponseEntity saveAnswers( signUpService.saveAnswers(answers, memberId); - return ResponseEntity.noContent().build(); + return ResponseEntity.ok().build(); } @@ -128,7 +127,7 @@ public ResponseEntity saveAnswers( public ResponseEntity finishSignUp(@Authenticated Long memberId, @Valid @RequestBody Optional> answers) { signUpService.completeSignUp(answers.orElse(new ArrayList<>()), memberId); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); + return ResponseEntity.noContent().build(); } diff --git a/resource-server/src/test/java/com/inhabas/api/web/MemberControllerTest.java b/resource-server/src/test/java/com/inhabas/api/web/MemberControllerTest.java index 49accccc..cfe724f3 100644 --- a/resource-server/src/test/java/com/inhabas/api/web/MemberControllerTest.java +++ b/resource-server/src/test/java/com/inhabas/api/web/MemberControllerTest.java @@ -147,7 +147,7 @@ public void getApprovedMembers() throws Exception { } - @DisplayName("비활동 이상 멤버 권한을 변경할 때 가능한 권한이면 200, 아니면 400을 반환한다.") + @DisplayName("비활동 이상 멤버 권한을 변경할 때 가능한 권한이면 204, 아니면 400을 반환한다.") @ParameterizedTest @ValueSource(strings = {"ADMIN", "SIGNING_UP"}) public void updateApprovedMembers(String roleString) throws Exception {