Skip to content

Comments

QR Code 발급 및 인증 기능 구현 완료#24

Merged
cxxxtxxyxx merged 39 commits intolivable-final:developfrom
cxxxtxxyxx:feature/#22-qrcode-api
Sep 18, 2023
Merged

QR Code 발급 및 인증 기능 구현 완료#24
cxxxtxxyxx merged 39 commits intolivable-final:developfrom
cxxxtxxyxx:feature/#22-qrcode-api

Conversation

@cxxxtxxyxx
Copy link
Contributor

@cxxxtxxyxx cxxxtxxyxx commented Sep 17, 2023

추가 구현 필요

  • JWT 연동 및 검증
  • UnitTest 작성
    • ControllerTest
    • ServiceTest

Invitation, Visitor Repository 생성
QrCodeManager 클래스 생성 및 구현
QrPayload 클래스 생성
VisitorId를 통해 해당 방문자의 초대장 Id를 조회
QR 생성 및 유효성 검사를 위해 초대장 시작 및 종료 시간을 조회
VisitationService에서 QrCodeManager를 사용하여 QR 관리
Service, Repository의 의존성을 1대1로 관리하기 위해 Facade 객체 구현
HttpStatus 및 Message 관리 객체
@cxxxtxxyxx cxxxtxxyxx added the develop 기능 개발 label Sep 17, 2023
@cxxxtxxyxx cxxxtxxyxx requested a review from hyunsb September 17, 2023 15:45
@cxxxtxxyxx cxxxtxxyxx self-assigned this Sep 17, 2023
사용하지 않는 불필요한 메서드 제거
컨벤션에 맞도록 메서드 명 수정
get -> create
컨벤션에 맞도록 줄바꿈 추가
VisitationController createQrCode에 대한 MVC 테스트 구현
VisitationController createQrCode에 대한 MVC 테스트 구현
RequestBodyDto 객체에 @builder 어노테이션을 붙이는 대신 상속 모킹 객체를 생성해서 대신 사용
InvitationServiceTest 내부에 MockBean import문 제거
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);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

이 부분은 JWT 연동 이후 토큰에서 값 가져오도록 수정할 것 같습니다!

Comment on lines 21 to 28
return VisitationResponse.InvitationTimeDto
.builder()
.startTime(invitation.getStartTime())
.endTime(invitation.getEndTime())
.startDate(invitation.getStartDate())
.endDate(invitation.getEndDate())
.build();
}
Copy link
Member

Choose a reason for hiding this comment

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

요거 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;
}
Copy link
Member

Choose a reason for hiding this comment

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

이거 설계가 참 좋은 거 같습니다 👍

@cxxxtxxyxx cxxxtxxyxx merged commit 22d8cb4 into livable-final:develop Sep 18, 2023
@cxxxtxxyxx cxxxtxxyxx added the review 코드 리뷰 요청 label Oct 6, 2023
@khsrla9806 khsrla9806 requested a review from kledyu October 6, 2023 07:47

Map<EncodeHintType, Object> encodeHints = getEncodeHints();

QRCodeWriter qrCodeWriter = new QRCodeWriter();
Copy link
Member

Choose a reason for hiding this comment

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

해당 메서드는 호출될 때마다 QRCodeWriter 객체가 생성될 거 같아요
메서드 내에서 특정 객체를 new 해버리면 테스트하기 어려울 거 같습니다!

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

Labels

develop 기능 개발 review 코드 리뷰 요청

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants