Skip to content

Commit

Permalink
[feat]충돌 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
CYJhub committed Jul 27, 2023
2 parents 17735cc + efe6b71 commit c261e9e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Empty file added .github/workflows/main.yml
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ public ResponseEntity<BrandRes.BrandDetailDto> showOneBrand(HttpServletRequest h
// index와 30을 곱하여 startIndex 계산
int startIndex = index * 30;


// startIndex부터 30개씩의 카드를 잘라서 resultCards 리스트에 저장
List<Card> resultCards = getLimitedCardsByIndex(cards, startIndex);



if (resultCards.isEmpty()) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
}

brandDetailDto.setCard(resultCards);


// 로그인이 안되어있을 경우 scrapCnt를 0으로 설정
//로그인이 안되어있을 경우 scrapCnt를 0으로 설정
if (jwtTokenProvider.getUserInfoByToken(httpRequest) == null) {
setScrapCntWhenTokenNotProvided(brandDetailDto.getCard());
}
Expand All @@ -76,6 +76,7 @@ public ResponseEntity<BrandRes.BrandDetailDto> showOneBrand(HttpServletRequest h
.body(brandDetailDto);
}


private void setScrapCntWhenTokenNotProvided(List<Card> cardList) {
for (Card card : cardList) {
card.setScrapCnt(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,13 @@ public ResponseEntity<List<CopyRes>> copyList(HttpServletRequest httpRequest, @P
public ResponseEntity<List<CopySearchResult>> copySearchList(HttpServletRequest httpRequest,
@RequestParam(name = "keyword") String q,
@PathVariable int index) {
//CopySearchResponse response = new CopySearchResponse();
CopySearchResult result = new CopySearchResult();

List<CopySearchResult> results = new ArrayList<>();

if (q.isEmpty()) { // 검색 결과가 없다면
//response.setData(results);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(results);

}

// 검색 결과 처리 로직...
Expand Down Expand Up @@ -142,9 +140,9 @@ public ResponseEntity<List<CopySearchResult>> copySearchList(HttpServletRequest
}

if (results.isEmpty()) {
//response.setData(results);
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(results);

}

// 요청한 index에 따라 30개씩 다른 결과를 생성
Expand All @@ -155,6 +153,7 @@ public ResponseEntity<List<CopySearchResult>> copySearchList(HttpServletRequest

return ResponseEntity.status(HttpStatus.OK)
.body(results1);

}


Expand Down
3 changes: 2 additions & 1 deletion src/main/java/shop/hooking/hooking/exception/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum ErrorCode {

//400 BAD_REQUEST : 잘못된 요청
CANNOT_EMPTY_CONTENT(BAD_REQUEST, "내용이 비어있을 수 없습니다."),
CANNOT_DUPLICATE_SCRAP(BAD_REQUEST, "스크랩을 중복해서 저장할 수 없습니다."),
INVALID_VALUE(BAD_REQUEST, "올바르지 않은 값입니다."),
INVALID_IMAGE_FILE(BAD_REQUEST, "잘못된 이미지 파일입니다."),
INVALID_SESSION_USER(BAD_REQUEST, "세션 유저가 비어있습니다."),
Expand All @@ -25,7 +26,7 @@ public enum ErrorCode {

//404 NOT_FOUND : Resource를 찾을 수 없음
USER_NOT_FOUND(NOT_FOUND, "해당 유저 정보를 찾을 수 없습니다."),

COPY_NOT_FOUND(NOT_FOUND, "해당 카피를 찾을 수 없습니다."),
//500 INTERNAL_SERVER_ERROR : 서버 내 문제
EXCEPTION(INTERNAL_SERVER_ERROR, "서버 내에 알 수 없는 오류가 발생했습니다."),
IO_EXCEPTION(INTERNAL_SERVER_ERROR, "이미지 업로드/다운로드 중 알 수 없는 오류가 발생했습니다.");
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
# jackson:
# serialization:
# fail-on-empty-beans: false

app:
deployment:
Expand Down

0 comments on commit c261e9e

Please sign in to comment.