-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature #21-QuingService #24
Conversation
append getList countForward doneWaiting
서비스가 여러개 얽히니까 unit test보다 integration test가 동작을 확인하기에 편한거같네요 이런경우에는 둘 다 작성해야겠죠? |
|
||
@Override | ||
public List<WaitingResponse> getList(long storeId) { | ||
// return waitingRepository.findAllByStoreId(storeId) |
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.
지워도 될 거 같습니다.
|
||
@Override | ||
@Transactional | ||
public WaitingResponse append(WaitingRequest waitingRequest) { |
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.
[q]
한 사용자가 중복으로 줄서기 하는 경우는 어떻게 처리되나요? 이 메서드에는 방어 로직이 없는 거 같은데..
public int countForward(long waitingId) { | ||
Waiting waiting = waitingRepository.findById(waitingId).orElseThrow(NoSuchWaitingException::new); | ||
List<WaitingResponse> list = getList(waiting.getStore().getId()); | ||
return list.indexOf(waiting.toResponse()); |
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.
이 operation의 시간 복잡도는 어떻게 될까요?
네 둘 다 작성하는게 좋고, 둘 중 하나만 가능하다면 저는 UT를 추가하는 것이 더 좋을 거 같습니다. IT는 실행하는 데 시간이 오래걸리고, dependency로 인해 실패하는 경우가 많아서 나중에 관리하기가 힘든 단점이 있습니다. |
@f-lab-trey 리뷰부탁드릴게요 |
Store store = storeRepository.findById(waitingRequest.getStoreId()).orElseThrow(NoSuchStoreException::new); | ||
Waiting waiting = Waiting.of(user, store); | ||
|
||
Optional<Waiting> exist = waitingRepository.findByUserIdAndWaitingQueueStatusIs(user.getId(), WaitingQueueStatus.WAITING); |
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.
[q]
이 operation의 시간복잡도는 어떻게 될까요? 중복을 체크하기 위해 너무 비싼 operation을 하는 게 아닐까요?
} | ||
|
||
@Test | ||
void append_exist_throw_exception() { |
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.
[minor]
테스트 이름을 camel case로 바꿔주세요.
when(waitingRepository.save(any())).thenReturn(waiting); | ||
|
||
WaitingResponse waitingResponse = quingService.append(waitingRequest); | ||
System.out.println("waitingResponse = " + waitingResponse); |
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.
logger로 변경해주세요.
# src/main/java/flab/quing/user/User.java # src/main/java/flab/quing/user/UserRepository.java
# Conflicts: # src/main/java/flab/quing/user/User.java # src/main/java/flab/quing/user/UserRepository.java
* Hotfix #34-스프링부트어드민 추가, 머지 후 실행안됨 (#35) * #23-스프링 액추에이터 추가, 어드민 클라이언트 추가 * #23-springboot admin 버전 명시 * Feature #21-QuingService (#24) * #21-변수명 변경 phone -> phoneNumber * #21-타입변경 Integer -> int * #21-안쓰는 파일 삭제 * #21-사용하지않는 필드 제거 * #21-QuingService 일부 구현 append getList countForward doneWaiting * #21-QuingService test 일부 구현 * #21-주석 삭제 * #21-append 중복 방지 로직 추가 * #21-waiting cancel 구현 * #21-exception 패키지 이동 * #21-test코드 작성 * Feature #22-waiting - 사용자에게 메시지 send 구현 (#27) * #21-cancel 리턴 타입 변경 * #22-message 전송 관련 부분 print로 임시 구현 * #22-message 전송 관련 부분 test 작성 * #22-test에 불필요한 공백 제거 * #22- test코드 logger 적용 * #22- test코드 given, when, then 분리 * #22- test코드 logger 적용 * #22-리뷰반영 - 테스트 공백, 주석 정리 - 테스트 이름 변경 appendExistThrowDuplicateException * # Conflicts: # src/main/java/flab/quing/user/User.java # src/main/java/flab/quing/user/UserRepository.java * #21-user response import * #37-storeManager가 관리하는 store 연결 (1:1) - response에서 password 삭제 * #28-QuingController 작성 - 로그인한 가게(storeManager-store)의 대기열 목록(get quing) - 로그인한 유저의 현재 대기순서(get quing/count-forward) - 대기 생성 (post quing) - WaitingRequest 생성자 추가(jackson에서 필요) * #39-quingservice import 경로 수정 (#41) - Rating OneToOne Cascade 삭제 * #28-리뷰반영 - 기본경로 의미없는 ("") 삭제 - method private로 변경 * #28-Waiting done, cancel 추가 * #28-getByuser 추가 - done, cancel을 하기위해 userid로 waiting을 가져오는게 필요해서 추가 * #28-append request 추가 * #28-storeId로 변경 * #28-QuingController test 작성 * #28-private 제거 - controller는 다른데서 호출될일이 없겠거니 하고 private를 달았는데 이것 때문에 테스트가 불가하여 Access Modifier를 defualt로 변경..
QuingService 일부 구현중
Todo
나머지 구현
테스트 작성