-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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로 변경..
- Loading branch information
Showing
10 changed files
with
307 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package flab.quing.waiting; | ||
|
||
import flab.quing.user.dto.StoreManagerResponse; | ||
import flab.quing.user.dto.UserResponse; | ||
import flab.quing.waiting.dto.WaitingAppendRequest; | ||
import flab.quing.waiting.dto.WaitingRequest; | ||
import flab.quing.waiting.dto.WaitingResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.bind.annotation.SessionAttribute; | ||
|
||
import java.util.List; | ||
|
||
@RequiredArgsConstructor | ||
@RestController | ||
@RequestMapping("/api/v1/quing") | ||
public class QuingController { | ||
|
||
private final QuingService quingService; | ||
|
||
|
||
@GetMapping | ||
List<WaitingResponse> list( | ||
@SessionAttribute(name = "AUTH_STORE") | ||
StoreManagerResponse storeManagerResponse | ||
) { | ||
long storeId = storeManagerResponse.getStoreId(); | ||
|
||
return quingService.getList(storeId); | ||
} | ||
|
||
@GetMapping("count-forward") | ||
long countForward(@SessionAttribute(name = "AUTH_USER") | ||
UserResponse userResponse | ||
) { | ||
return quingService.countForward(userResponse.getUserId()); | ||
} | ||
|
||
@PostMapping | ||
@ResponseStatus(HttpStatus.CREATED) | ||
WaitingResponse append( | ||
@SessionAttribute(name = "AUTH_USER") | ||
UserResponse userResponse, | ||
@RequestBody WaitingAppendRequest waitingAppendRequest | ||
) { | ||
WaitingRequest waitingRequest = WaitingRequest.builder() | ||
.userId(userResponse.getUserId()) | ||
.storeId(waitingAppendRequest.getStoreId()) | ||
.build(); | ||
|
||
WaitingResponse waitingResponse = quingService.append(waitingRequest); | ||
|
||
quingService.sendRegisterMessage(waitingResponse.getId()); | ||
|
||
return waitingResponse; | ||
} | ||
|
||
@PatchMapping | ||
WaitingResponse doneWaiting( | ||
@SessionAttribute(name = "AUTH_USER") | ||
UserResponse userResponse | ||
) { | ||
WaitingResponse waitingResponseByUserId = quingService.getByUserId(userResponse.getUserId()); | ||
|
||
return quingService.doneWaiting(waitingResponseByUserId.getId()); | ||
} | ||
|
||
@DeleteMapping | ||
@ResponseStatus(HttpStatus.NO_CONTENT) | ||
void cancelWaiting( | ||
@SessionAttribute(name = "AUTH_USER") | ||
UserResponse userResponse | ||
) { | ||
WaitingResponse waitingResponseByUserId = quingService.getByUserId(userResponse.getUserId()); | ||
|
||
quingService.cancelWaiting(waitingResponseByUserId.getId()); | ||
} | ||
} |
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
src/main/java/flab/quing/waiting/dto/WaitingAppendRequest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package flab.quing.waiting.dto; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@Data | ||
@Setter(AccessLevel.NONE) | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@AllArgsConstructor | ||
public class WaitingAppendRequest { | ||
|
||
long storeId; | ||
} |
This file contains 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
Oops, something went wrong.