Skip to content

Commit

Permalink
[Chore] #283 - 메소드 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
parkrootseok committed Jun 19, 2023
1 parent 71d7fac commit 2a67886
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import shop.cazait.domain.congestion.dto.response.CongestionUpdateOutDTO;
import shop.cazait.domain.congestion.exception.CongestionException;
import shop.cazait.domain.congestion.service.CongestionService;
import shop.cazait.domain.user.exception.UserException;
import shop.cazait.global.common.dto.response.SuccessResponse;
import shop.cazait.global.config.encrypt.JwtService;
import shop.cazait.global.error.status.SuccessStatus;
Expand All @@ -41,7 +40,7 @@ public SuccessResponse<CongestionUpdateOutDTO> addCongestion(@PathVariable Long
throws CongestionException {

return new SuccessResponse<>(
SuccessStatus.CREATE_CONGESTION, congestionService.addAndUpdateCongestion(cafeId, congestionUpdateInDTO));
SuccessStatus.CREATE_CONGESTION, congestionService.createOrUpdateCongestion(cafeId, congestionUpdateInDTO));

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package shop.cazait.domain.congestion.service;

import static shop.cazait.global.common.constant.Constant.NOT_EXIST_CONGESTION;
import static shop.cazait.global.error.status.ErrorStatus.INVALID_CONGESTION;
import static shop.cazait.global.error.status.ErrorStatus.NOT_EXIST_CAFE;

import java.util.NoSuchElementException;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -29,21 +29,18 @@ public class CongestionService {
/**
* 혼잡도 등록 및 수정
*/
public CongestionUpdateOutDTO addAndUpdateCongestion(Long cafeId, CongestionUpdateInDTO congestionUpdateInDTO) {
public CongestionUpdateOutDTO createOrUpdateCongestion(Long cafeId, CongestionUpdateInDTO congestionUpdateInDTO) {

Cafe findCafe = getCafe(cafeId);
Congestion findCongestion = findCafe.getCongestion();
Congestion newCongestion = null;

CongestionStatus congestionStatus = getCongestionStatus(congestionUpdateInDTO.getCongestionStatus());

if (findCongestion == NOT_EXIST_CONGESTION) {
if (Objects.isNull(findCongestion)) {
newCongestion = addCongestion(findCafe, congestionStatus);
}

if (findCongestion != NOT_EXIST_CONGESTION) {
} else {
newCongestion = updateCongestion(findCongestion, congestionStatus);

}

return CongestionUpdateOutDTO.of(newCongestion);
Expand Down

0 comments on commit 2a67886

Please sign in to comment.