Skip to content

#20 회원가입#21

Open
alrscent wants to merge 5 commits intomainfrom
feature/20
Open

#20 회원가입#21
alrscent wants to merge 5 commits intomainfrom
feature/20

Conversation

@alrscent
Copy link
Copy Markdown
Collaborator

  • 로그인 인증을 위한 spring security 설정
  • 회원가입 백엔드 API 개발
  • ErrorCode 개선

@alrscent alrscent requested a review from f-lab-martin March 26, 2026 06:29
@alrscent alrscent self-assigned this Mar 26, 2026
@Profile("local")
@RestController
@RequestMapping("/test")
public class TestController {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 컨트롤러는 사용되지 않으면 삭제하면 어떨까요?
controller test 를 위해서 @WebMvcTest를 이용하여 테스트코드로 작성해보면 어떨까요?

@RestController
@RequestMapping("/api")
public class MemberController {
private final MemberService memberService;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controller test 를 추가해보면 어떨까요?

}

@PostMapping("/members")
public ResponseEntity<Void> addMember(@RequestBody @Valid MemberSignUpRequest request) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MemberSignUpRequest가 valid한지 체크하는 부분도 테스트해볼 수 있을까요?

@PostMapping("/members")
public ResponseEntity<Void> addMember(@RequestBody @Valid MemberSignUpRequest request) {
memberService.addMember(request);
return ResponseEntity.status(HttpStatus.CREATED).build();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

회원가입이 되고 나서 생성된 회원에 대한 정보를 필요로 할 수 있어 보입니다.
그리고 DB에 저장하게 되면 ID도 생성될 것 같고요!
회원 정보를 응답 바디로 내려주면 어떨까요?

Comment on lines -13 to +14
private String loginId;
String loginId,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private을 지우신 이유가 있으실까요?

Comment on lines +41 to +43
if (getMemberByLoginId(request.loginId()) != null) {
throw new QueueTixException(MemberErrorCode.MEMBER_DUPLICATED_LOGIN_ID);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getter를 통해서 데이터를 가져온 후 비교하지 않고 validate 하는 메소드로 바로 분리해보면 어떨까요?

Comment on lines +52 to +55
public Member getMemberByLoginId(String loginId) throws QueueTixException {
return memberRepository.findByLoginId(loginId)
.orElse(null);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validation을 하기 위해서 사용한 코드라면 .orElse로 null를 리턴해서 null check를 하지 않는 방향으로 수정할 수 있을까요?

Comment on lines 5 to 9
password VARCHAR(255) NOT NULL ,
name VARCHAR(100) NOT NULL,
email VARCHAR(50) NOT NULL,
phone VARCHAR(12),
phone VARCHAR(13),
address VARCHAR(500)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용하는 RDB에 따라서 VARCHAR 대신 TEXT 타입을 쓰는 것이 편할 수 있습니다. 어떤 RDB를 사용하실 예정이신가요?

Comment on lines +72 to +74
QueueTixException exception = assertThrows(QueueTixException.class, () -> memberService.addMember(request));

assertThat(exception.getErrorCode()).isSameAs(MemberErrorCode.MEMBER_DUPLICATED_EMAIL);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertThatThrownBy를 사용해보시면 어떨까요?

Comment on lines +1 to +17
### QueueTixException 처리 테스트
GET http://localhost:8080/test/queue-tix
Accept: application/json
### IllegalArgumentException 처리 테스트
GET http://localhost:8080/test/illlegal-argument
Accept: application/json
### serverError 처리 테스트
GET http://localhost:8080/test/server-error
Accept: application/json
### validation Error 처리 테스트
GET http://localhost:8080/test/validation
Accept: application/json
Content-Type: application/json

{
"loginId": "test"
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헬스체크는 spring actuator를 사용해보면 어떨까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants