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

v0.3.3 dev pre-release #273

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/docs/asciidoc/api/user/user.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ include::{snippets}/find-user-info-doc/http-response.adoc[]

include::{snippets}/find-user-info-doc/response-fields-data.adoc[]

=== 로그아웃
==== HTTP Request
include::{snippets}/user-logout-doc/http-request.adoc[]


=== 사용자가 빌린 우산 조회

==== HTTP Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import upbrella.be.store.service.StoreMetaService;
import upbrella.be.util.CustomResponse;

import javax.servlet.http.HttpSession;
import java.time.LocalDateTime;
import java.util.List;

Expand All @@ -28,16 +27,16 @@ public class StoreController {
private final ClassificationService classificationService;
private final StoreDetailService storeDetailService;

@GetMapping("/stores/{storeId}")
public ResponseEntity<CustomResponse<StoreFindByIdResponse>> findStoreById(@PathVariable long storeId) {
@GetMapping("/stores/{storeDetailId}")
public ResponseEntity<CustomResponse<StoreFindByIdResponse>> findStoreById(@PathVariable long storeDetailId) {

return ResponseEntity
.ok()
.body(new CustomResponse<>(
"success",
200,
"가게 조회 성공",
storeDetailService.findStoreDetailByStoreMetaId(storeId)));
storeDetailService.findStoreDetailByStoreMetaId(storeDetailId)));
}

@GetMapping("/stores/classification/{classificationId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public StoreDetail findStoreDetailById(Long storeId) {
}

@Transactional
public StoreFindByIdResponse findStoreDetailByStoreMetaId(long storeMetaId) {
public StoreFindByIdResponse findStoreDetailByStoreMetaId(long storeDetailId) {

StoreDetail storeDetail = storeDetailRepository.findByStoreMetaIdUsingFetchJoin(storeMetaId)
.orElseThrow(() -> new NonExistingStoreDetailException("[ERROR] 해당하는 협업 지점이 존재하지 않습니다."));
StoreDetail storeDetail = findStoreDetailById(storeDetailId);
long storeMetaId = storeDetail.getStoreMeta().getId();

long availableUmbrellaCount = umbrellaService.countAvailableUmbrellaAtStore(storeMetaId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void success() {

// given

given(storeDetailRepository.findByStoreMetaIdUsingFetchJoin(3L))
given(storeDetailRepository.findById(3L))
.willReturn(Optional.of(storeDetail));

given(umbrellaService.countAvailableUmbrellaAtStore(3L))
Expand All @@ -109,29 +109,11 @@ void success() {
.usingRecursiveComparison()
.isEqualTo(storeFindByIdResponseExpected),
() -> then(storeDetailRepository).should(times(1))
.findByStoreMetaIdUsingFetchJoin(3L),
.findById(3L),
() -> then(umbrellaService).should(times(1))
.countAvailableUmbrellaAtStore(3L)
);
}

@DisplayName("해당하는 협업 지점이 존재하지 않거나 삭제되었으면 예외를 발생시킨다.")
@Test
void isNotExistingStore() {

//given
given(storeDetailRepository.findByStoreMetaIdUsingFetchJoin(3L))
.willReturn(Optional.ofNullable(null));

//when & then
assertAll(
() -> assertThatThrownBy(() -> storeDetailService.findStoreDetailByStoreMetaId(3L))
.isInstanceOf(NonExistingStoreDetailException.class),
() -> then(storeDetailRepository).should(times(1))
.findByStoreMetaIdUsingFetchJoin(3L),
() -> then(umbrellaService).shouldHaveNoInteractions()
);
}
}

@Nested
Expand Down