Skip to content

Commit

Permalink
#18 [Refactor] 코드 리팩토링
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Jin committed Jul 26, 2022
1 parent 9244498 commit e4b6591
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void review(ReviewRequestDto reviewRequestDto, String socialId) throws IO
tagRepository .saveAll(tagList);
reviewImageRepository.saveAll(reviewImageUrlList);
reviewRepository .save(review); // 아래의 {store.updatePointAvg()} 보다 리뷰가 먼저 처리되게 해야한다.
storeRepository.save(store.updatePointAvg(reviewRequestDto.getPoint())); //별점 평균 구하는 코드
storeRepository.save(store.updatePointAvg()); //별점 평균 구하는 코드
}


Expand Down Expand Up @@ -151,7 +151,7 @@ public void reviewUpdate(ReviewRequestDto reviewRequestDto, String socialId, int

review.update(reviewRequestDto);
reviewRepository.save(review); // 아래의 store.updatePointAvg() 보다 리뷰가 먼저 처리되게 해야한다.
storeRepository .save(store.updatePointAvg(reviewRequestDto.getPoint())); // 별점 평점 구하는 코드
storeRepository .save(store.updatePointAvg()); // 별점 평점 구하는 코드
reviewImageRepository.saveAll(reviewImageUrlList);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/mpnp/baechelin/store/domain/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class Store {

public Store(PublicApiV1Form.Row row) {
//storeId - 임시
this.id = Long.valueOf(row.getStoreId());
this.id = row.getStoreId();
this.name = row.getSISULNAME();
this.address = DataClarification.clarifyString(row.getADDR());
this.phoneNumber = row.getTEL();
Expand All @@ -103,7 +103,7 @@ public Store updateBookmarkCount(int upOrDown) {
}

// TODO 리뷰가 삭제될 때도 고려하기 - 삭제 후 적용되어야 함
public Store updatePointAvg(double changePoint) {
public Store updatePointAvg() {
this.reviewCount = reviewList.size();
double totalPoint = 0.0;
for (Review review : reviewList) {
Expand All @@ -114,7 +114,7 @@ public Store updatePointAvg(double changePoint) {
}

public Store(LocationInfoDto.LocationResponse sr, PublicApiV2Form.ServList servList, List<String> barrierTagList) {
this.id = Long.valueOf(sr.getStoreId());
this.id = sr.getStoreId();
this.name = sr.getStoreName();
this.latitude = new BigDecimal(servList.getFaclLat());
this.longitude = new BigDecimal(servList.getFaclLng());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.mpnp.baechelin.store.domain;

import com.mpnp.baechelin.review.domain.Review;
import com.mpnp.baechelin.util.TimeStamped;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down

0 comments on commit e4b6591

Please sign in to comment.