QR Code 발급 및 인증 기능 구현 완료#24
Merged
cxxxtxxyxx merged 39 commits intolivable-final:developfrom Sep 18, 2023
Merged
Conversation
Invitation, Visitor Repository 생성
zxing 의존성 추가
QrCodeManager 클래스 생성 및 구현 QrPayload 클래스 생성
VisitorId를 통해 해당 방문자의 초대장 Id를 조회
QR 생성 및 유효성 검사를 위해 초대장 시작 및 종료 시간을 조회
VisitationService에서 QrCodeManager를 사용하여 QR 관리
Service, Repository의 의존성을 1대1로 관리하기 위해 Facade 객체 구현
HttpStatus 및 Message 관리 객체
사용하지 않는 불필요한 메서드 제거
컨벤션에 맞도록 메서드 명 수정 get -> create
컨벤션에 맞도록 줄바꿈 추가
VisitationController createQrCode에 대한 MVC 테스트 구현
VisitationController createQrCode에 대한 MVC 테스트 구현
RequestBodyDto 객체에 @builder 어노테이션을 붙이는 대신 상속 모킹 객체를 생성해서 대신 사용
VisitationService 테스트
InvitationServiceTest 내부에 MockBean import문 제거
objectMapper.registerModule(new JavaTimeModule()).writeValueAsString(expirationPeriodMap)로 수정
cxxxtxxyxx
commented
Sep 18, 2023
Comment on lines
22
to
26
| Long visitorId = 1L; | ||
| VisitationResponse.InvitationTimeDto invitationTime = visitationFacadeService.findInvitationTime(visitorId); | ||
| String base64QrCode = visitationFacadeService.createQrCode(invitationTime.getStartDateTime().minusHours(1), invitationTime.getEndDateTime().plusHours(1)); | ||
|
|
||
| return ApiResponse.success(base64QrCode, HttpStatus.OK); |
Contributor
Author
There was a problem hiding this comment.
이 부분은 JWT 연동 이후 토큰에서 값 가져오도록 수정할 것 같습니다!
Facade객체에서 다양한 Service에 대한 의존을 통해 로직 처리
hyunsb
reviewed
Sep 18, 2023
Comment on lines
21
to
28
| return VisitationResponse.InvitationTimeDto | ||
| .builder() | ||
| .startTime(invitation.getStartTime()) | ||
| .endTime(invitation.getEndTime()) | ||
| .startDate(invitation.getStartDate()) | ||
| .endDate(invitation.getEndDate()) | ||
| .build(); | ||
| } |
Member
There was a problem hiding this comment.
요거 InvitationTimeDTO 안에 정적 팩토리 메서드로 처리하면 더 깔끔할 거 같아요
public static InvitationTimeDTO from(Invitation invitation) {
return InvitationTimeDTO.builder()
...
;
}
Comment on lines
8
to
22
| @Getter | ||
| @AllArgsConstructor | ||
| public enum VisitationErrorCode implements ErrorCode { | ||
|
|
||
| OBJECTMAPPER(HttpStatus.INTERNAL_SERVER_ERROR, "직렬화 과정에서 알 수 없는 에러가 발생했습니다."), | ||
| QR_ENCODE(HttpStatus.INTERNAL_SERVER_ERROR, "QR코드 생성 중 알 수 없는 에러가 발생했습니다."), | ||
| QR_DECODE(HttpStatus.INTERNAL_SERVER_ERROR, "QR코드를 푸는 과정에서 알 수 없는 에러가 발생했습니다."), | ||
| IO(HttpStatus.INTERNAL_SERVER_ERROR, "I/O를 진행하는 과정에서 알 수 없는 에러가 발생했습니다."), | ||
| INVALID_PERIOD(HttpStatus.BAD_REQUEST, "QR 기간이 유효하지 않습니다."), | ||
| NOT_FOUND(HttpStatus.BAD_REQUEST, "존재하지 않는 정보입니다."); | ||
|
|
||
|
|
||
| private final HttpStatus httpStatus; | ||
| private final String message; | ||
| } |
hyunsb
reviewed
Oct 6, 2023
|
|
||
| Map<EncodeHintType, Object> encodeHints = getEncodeHints(); | ||
|
|
||
| QRCodeWriter qrCodeWriter = new QRCodeWriter(); |
Member
There was a problem hiding this comment.
해당 메서드는 호출될 때마다 QRCodeWriter 객체가 생성될 거 같아요
메서드 내에서 특정 객체를 new 해버리면 테스트하기 어려울 거 같습니다!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
추가 구현 필요