-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: osiv 옵션 해제 및 swagger 문서 정리 #70
base: develop
Are you sure you want to change the base?
Conversation
val token = AuthorizationHeaderUtils.extractBearerToken(webRequest) | ||
val userEmail = jwtTokenProvider.getPayload(token) | ||
return memberService.getByEmail(userEmail) | ||
return LoggedInMemberRequest(userEmail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AS-IS
LoginUserResolver
에서 Entity 직접 반환
TO-DO
LoginUserResolver
에서 payload 값을 담는 DTO를 반환
osiv를 끄면 영속성 컨텍스트 라이프사이클이 비즈니스 레이어(service layer)이외에는 꺼져있으므로 DTO를 반환하게 했습니다. 이후 서비스 로직에서 엔티티를 찾아와 영속화시켜 비밀번호 변경 등, 변경 로직을 성공하게 했습니다.
@@ -18,23 +18,23 @@ class GenerationController( | |||
private val generationService: GenerationService | |||
) { | |||
|
|||
@Operation(summary = "현재 기수 조회") | |||
@Operation(summary = "[관리자 페이지] 현재 기수 조회") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GenerationController
에서 [관리자 페이지]
문구가 모두 누락되어 있어 추가해주었습니다.
val updatedAttendance = attendanceRepository.findByIdOrNull(attendance.id) | ||
val updatedGenerationMember = generationMemberRepository.findByIdOrNull(generationMember.id) | ||
updatedAttendance?.attendanceStatus shouldBe AttendanceStatus.TARDY | ||
updatedAttendance?.scoreChanged shouldBe AttendanceStatus.TARDY.penaltyScore | ||
updatedGenerationMember?.score shouldBe MAX_SCORE + AttendanceStatus.TARDY.penaltyScore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 코드에서 @Transactional
을 제거하면 영속성 컨텍스트 관리 대상에서 제거되므로 영속 상태로 끌어올려 변경 여부를 제대로 테스트할 수 있도록 했습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고치려다가 깨지는 테스트 고칠 시간이 없어서 보류했었는데 잘했소
val updatedAttendance = attendanceRepository.findByIdOrNull(attendance.id) | ||
val updatedGenerationMember = generationMemberRepository.findByIdOrNull(generationMember.id) | ||
updatedAttendance?.attendanceStatus shouldBe AttendanceStatus.TARDY | ||
updatedAttendance?.scoreChanged shouldBe AttendanceStatus.TARDY.penaltyScore | ||
updatedGenerationMember?.score shouldBe MAX_SCORE + AttendanceStatus.TARDY.penaltyScore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고치려다가 깨지는 테스트 고칠 시간이 없어서 보류했었는데 잘했소
@LoggedInMember member: LoggedInMemberRequest, | ||
@RequestBody @Valid request: ValidateQrCodeRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어노테이션명과 매개변수명이 아직 좀 entity스러운데 적절한 네이밍이 떠오른다면 수정하는게 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 진짜 고민되더라고요ㅋㅋㅋ 결국 request를 붙이긴 했는데 뭐가 좋을까요..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dto 제거해서 네이밍 고민할 필요가 사라졌습니다~
|
||
data class LoggedInMemberRequest(val email: String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoggedInMemberRequest라는 클래스로 감싸지 않고 email 문자열을 그대로 반환하는건 어떨까요?
getter를 써야하는 자바가 아니라 코틀린이라서 충분히 가독성이 높은 것 같긴한데, 그냥 이 클래스가 꼭 필요한가?라는 생각이 들었어요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일리 있는 의견이라 생각합니다. 👍
구현사항
AttendanceServiceTest
에서 불필요한@Transactional
제거@Transactional
을 붙이는 것을 지양해야 하는 이유 - https://tecoble.techcourse.co.kr/post/2020-08-31-jpa-transaction-test/[관리자 페이지]
가 붙어있지 않던 명세 수정