Skip to content
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 #22-waiting - 사용자에게 메시지 send 구현 #27

Merged
merged 8 commits into from
Nov 10, 2022

Conversation

chanwooo
Copy link
Contributor

@chanwooo chanwooo commented Oct 31, 2022

ncloud sms기능 이용해서 구현하려고하는데
api key 때문에 property도 분리해야할거같고 공수가 좀 커보여서 일단 print로 구현해봤습니다.

@chanwooo chanwooo self-assigned this Oct 31, 2022
@f-lab-trey
Copy link
Collaborator

Base branch가 저번 PR (#24)이 되어야 하지 않나요? PR 제목이랑 상관없는 변경들이 보여요.

Comment on lines 60 to 66
public void sendMessage(long waitingId, String message) {
//ncloud sms
Waiting waiting = waitingRepository.findById(waitingId).orElseThrow(NoSuchWaitingException::new);
User user = waiting.getUser();
System.out.println("phoneNumber = " + user.getPhoneNumber());
System.out.println("message = " + user.getName()+"님 "+message);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분을 QuingService에 넣지말고, MessageSender interface를 구현한 ConsolePrintMessageSender 같은 새로운 class를 만드는 것이 더 좋을 거 같아요.

when(waitingRepository.save(any())).thenReturn(waiting);

WaitingResponse waitingResponse = quingService.append(waitingRequest);
System.out.println("waitingResponse = " + waitingResponse);
Copy link
Collaborator

Choose a reason for hiding this comment

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

logger를 사용하는게 더 좋을 거 같습니다.

Comment on lines 162 to 182
@Test
void doneWaiting() {
User user1 = DummyDataMaker.user();
Store store = DummyDataMaker.store();
Waiting waiting1 = DummyDataMaker.waiting(user1, store);
when(waitingRepository.findById(anyLong())).thenReturn(Optional.ofNullable(waiting1));
WaitingResponse waitingResponse = quingService.doneWaiting(1L);
System.out.println("waitingResponse = " + waitingResponse);
assertThat(waitingResponse.getWaitingQueueStatus()).isEqualTo(WaitingQueueStatus.DONE);
}

@Test
void cancelWaiting() {
User user1 = DummyDataMaker.user();
Store store = DummyDataMaker.store();
Waiting waiting1 = DummyDataMaker.waiting(user1, store);
when(waitingRepository.findById(anyLong())).thenReturn(Optional.ofNullable(waiting1));
WaitingResponse waitingResponse = quingService.cancelWaiting(1L);
System.out.println("waitingResponse = " + waitingResponse);
assertThat(waitingResponse.getWaitingQueueStatus()).isEqualTo(WaitingQueueStatus.CANCELED);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

given-when-then 형식으로 단락을 구분해주세요.

Comment on lines 50 to 51


Copy link
Collaborator

Choose a reason for hiding this comment

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

불필요한 공백인거 같습니다

Comment on lines 80 to 82



Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

@chanwooo chanwooo changed the base branch from develop to feature-#21 November 1, 2022 12:17
Comment on lines +67 to +68
System.out.println("phoneNumber = " + user.getPhoneNumber());
System.out.println("message = " + user.getName()+"님 "+message);
Copy link
Collaborator

Choose a reason for hiding this comment

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

logger로 변경해주세요.

Review review1 = DummyDataMaker.review(user1, waiting1, "review1");
Review review2 = DummyDataMaker.review(user1, waiting2, "review2");
Review review1 = reviewRepository.save(DummyDataMaker.review(user1, waiting1, "review1"));
log.info("review1 = " + review1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

log.info("review1 = {}", review1) 이런 느낌의 formatter를 사용할 수 없나요?

Copy link
Contributor Author

@chanwooo chanwooo Nov 10, 2022

Choose a reason for hiding this comment

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

한개인경우 자동으로 작성해주는 포멧을 이용했는데
출력할 변수가 여러개가 있는경우 MessageFormat 이라는게 있어서 적용했습니다.
MessageFormat.format("{0}, {1}, {2}", a,b,c));

review2.hide();
log.info("review2 = " + review2.getDeleted_at());
Review review3 = reviewRepository.save(DummyDataMaker.review(user2, waiting2, "review3"));
log.info("review3 = " + review3);
Copy link
Collaborator

Choose a reason for hiding this comment

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

가능하다면 log를 모아써 찍거나, log.info 아래에 빈 라인을 넣어주세요. 현재 상태는 읽기가 불편해 보입니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

로그를 보고자 한것끼리 묶이도록 한라인씩 띄어쓰기를 추가했습니다


List<Review> storeReviews = reviewRepository.findAllByWaitingStoreIdAndDeletedIsFalse(store.getId());
List<Review> allByWaitingStoreIdAndDeletedIsFalse = reviewRepository.findAllByWaitingStoreIdAndDeletedIsFalse(store.getId());
System.out.println("allByWaitingStoreIdAndDeletedIsFalse = " + allByWaitingStoreIdAndDeletedIsFalse);
// List<Review> storeReviews = reviewRepository.findAllByWaitingStoreId(store.getId());
Copy link
Collaborator

Choose a reason for hiding this comment

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

필요없으면 지워주세요.

- 테스트 공백, 주석 정리
- 테스트 이름 변경 appendExistThrowDuplicateException
@chanwooo chanwooo merged commit 368ffca into feature-#21 Nov 10, 2022
@chanwooo
Copy link
Contributor Author

close #22

chanwooo added a commit that referenced this pull request Nov 13, 2022
* #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
chanwooo added a commit that referenced this pull request Nov 21, 2022
* 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로 변경..
chanwooo added a commit that referenced this pull request Nov 22, 2022
* #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에서 필요)

* #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로 변경..
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.

None yet

2 participants