-
Notifications
You must be signed in to change notification settings - Fork 1
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 : owner 웨이팅 조회 API 구현 #75
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d041146
rename : 패키지 구조 변경
hyun2371 a6a50b2
style : dto명 변경
hyun2371 e647fdc
refactor : waitingRepository 리팩토링
hyun2371 6ab5e4e
feat : waitingRepository 함수 추가 및 테스트
hyun2371 edab978
feat : waitingLineRepository 기능 추가
hyun2371 e1017f0
feat : waitingLineRepository 추가된 기능 테스트
hyun2371 d0694f5
feat : owner 관련 DTO 추가
hyun2371 f494bcd
feat : dto 엔티티 매핑 함수 추가
hyun2371 46ace9b
feat : owner waiting 조회 서비스 로직 작성
hyun2371 7c4962f
feat : 기존 서비스 테스트 검증 누락된 부분 추가
hyun2371 2ca04c6
feat : owner 웨이팅 조회 서비스 테스트
hyun2371 2f5829b
feat : owner 웨이팅 조회 controller 메서드 추가
hyun2371 7afb52a
feat: owner 웨이팅 조회 통합 테스트 작성
hyun2371 f18dbdc
refactor : 코드 리포멧팅
hyun2371 c2eb81e
fix : ci 테스트 실패 오류 해결
hyun2371 5cdfadc
feat : basicWaitingLine 저장소 테스트 불필요한 로직 삭제 및 검증 메서드 추가
hyun2371 ec30c7c
refactor : 상태 변경 함수 메서드명 변경 및 불필요한 검증로직 삭제
hyun2371 08da5a3
refactor : 테스트 fixture reflectionUtil 대신 상태 함수 사용
hyun2371 5344cf7
feat : owner waiting 조회 단위 테스트 검증 로직 추가
hyun2371 c747742
refactor : redis rank 오름차순으로 정렬해 반환하는 로직 리팩토링
hyun2371 0939180
refactor : 코드 리포멧팅
hyun2371 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/prgrms/catchtable/waiting/controller/OwnerWaitingController.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,25 @@ | ||
package com.prgrms.catchtable.waiting.controller; | ||
|
||
import com.prgrms.catchtable.waiting.dto.response.OwnerWaitingListResponse; | ||
import com.prgrms.catchtable.waiting.service.OwnerWaitingService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequiredArgsConstructor | ||
@RequestMapping("owner/waitings") | ||
@RestController | ||
public class OwnerWaitingController { | ||
|
||
private final OwnerWaitingService ownerWaitingService; | ||
|
||
@GetMapping("/{ownerId}") | ||
public ResponseEntity<OwnerWaitingListResponse> getOwnerAllWaiting( | ||
@PathVariable("ownerId") Long ownerId) { | ||
OwnerWaitingListResponse response = ownerWaitingService.getOwnerAllWaiting(ownerId); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...ble/waiting/dto/CreateWaitingRequest.java → ...ing/dto/request/CreateWaitingRequest.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
4 changes: 2 additions & 2 deletions
4
...tchtable/waiting/dto/WaitingResponse.java → ...g/dto/response/MemberWaitingResponse.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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/prgrms/catchtable/waiting/dto/response/OwnerWaitingListResponse.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,11 @@ | ||
package com.prgrms.catchtable.waiting.dto.response; | ||
|
||
import java.util.List; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record OwnerWaitingListResponse( | ||
List<OwnerWaitingResponse> shopWaitings | ||
) { | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/prgrms/catchtable/waiting/dto/response/OwnerWaitingResponse.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,13 @@ | ||
package com.prgrms.catchtable.waiting.dto.response; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record OwnerWaitingResponse( | ||
Long waitingId, | ||
int waitingNumber, | ||
Long rank, | ||
int peopleCount | ||
) { | ||
|
||
} |
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
35 changes: 35 additions & 0 deletions
35
src/main/java/com/prgrms/catchtable/waiting/service/OwnerWaitingService.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,35 @@ | ||
package com.prgrms.catchtable.waiting.service; | ||
|
||
import static com.prgrms.catchtable.common.exception.ErrorCode.NOT_EXIST_OWNER; | ||
import static com.prgrms.catchtable.waiting.dto.WaitingMapper.toOwnerWaitingListResponse; | ||
|
||
import com.prgrms.catchtable.common.exception.custom.BadRequestCustomException; | ||
import com.prgrms.catchtable.owner.domain.Owner; | ||
import com.prgrms.catchtable.owner.repository.OwnerRepository; | ||
import com.prgrms.catchtable.waiting.domain.Waiting; | ||
import com.prgrms.catchtable.waiting.dto.response.OwnerWaitingListResponse; | ||
import com.prgrms.catchtable.waiting.repository.WaitingRepository; | ||
import com.prgrms.catchtable.waiting.repository.waitingline.WaitingLineRepository; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class OwnerWaitingService { | ||
|
||
private final WaitingRepository waitingRepository; | ||
private final WaitingLineRepository waitingLineRepository; | ||
private final OwnerRepository ownerRepository; | ||
|
||
@Transactional(readOnly = true) | ||
public OwnerWaitingListResponse getOwnerAllWaiting(Long ownerId) { | ||
Owner owner = ownerRepository.findById(ownerId) | ||
.orElseThrow(() -> new BadRequestCustomException(NOT_EXIST_OWNER)); | ||
List<Long> waitingIds = waitingLineRepository.getShopWaitingIdsInOrder( | ||
owner.getShop().getId()); | ||
List<Waiting> waitings = waitingRepository.findByIds(waitingIds); | ||
return toOwnerWaitingListResponse(waitings); | ||
} | ||
} |
Oops, something went wrong.
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.
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.
여기서 쿼리가 한방 더 나갈거같아요..!
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.
owner.getShop().getId() 부분 말씀하시는건가요? 현재 임시로만 ownerId를 받는거라서 fetch join은 구현하지 않았습니다!