Skip to content

Commit

Permalink
[Weekly/11/Refactor/All] Transactional 설정, 접근제어자 설정 (#142)
Browse files Browse the repository at this point in the history
* refactor: Review Transactional 설정

* refactor: RequestDto 접근제어자 private으로 변경
  • Loading branch information
ariimo authored Nov 15, 2024
1 parent 0a2cbee commit b77fc10
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class AdvertisementRequest {
private LocalDateTime endTime;

@AssertTrue(message = "종료 시간은 시작 시간 이후여야 합니다.")
public boolean isEndTimeAfterStartTime() {
private boolean isEndTimeAfterStartTime() {
return endTime.isAfter(startTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public class EventCreateRequest {
private List<Long> imageIds;

@AssertTrue(message = "종료 시간은 시작 시간 이후여야 합니다.")
public boolean isEndTimeAfterStartTime() {
private boolean isEndTimeAfterStartTime() {
if (startTime == null || endTime == null) {
return true;
}
return endTime.isAfter(startTime);
}

@AssertTrue(message = "이미지는 최대 5개까지 등록할 수 있습니다.")
public boolean isImageSizeValid() {
private boolean isImageSizeValid() {
return imageIds.size() <= 5;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public class EventEditRequest {
private List<Long> imageIds;

@AssertTrue(message = "종료 시간은 시작 시간 이후여야 합니다.")
public boolean isEndTimeAfterStartTime() {
private boolean isEndTimeAfterStartTime() {
if (startTime == null || endTime == null) {
return true;
}
return endTime.isAfter(startTime);
}

@AssertTrue(message = "이미지는 최대 5개까지 등록할 수 있습니다.")
public boolean isImageSizeValid() {
private boolean isImageSizeValid() {
return imageIds.size() <= 5;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private Long getLastId(Slice<Review> reviews, Long oldLastId) {
return oldLastId;
}

@Transactional
@Transactional(readOnly = true)
public ReviewEventSliceResponse getUnreviewedEventsByMemberId(Long memberId, Pageable pageable,
Long beforeLastId) {
Slice<Event> unreviewedEvents = reviewRepository.findUnreviewedEventsByMemberId(memberId,
Expand Down Expand Up @@ -95,8 +95,7 @@ public void delete(Long memberId, Long reviewId) {
reviewRepository.deleteById(reviewId);
}

@Transactional
public Review getByIdOrThrow(Long id) {
private Review getByIdOrThrow(Long id) {
return reviewRepository.findById(id)
.orElseThrow(() -> new EntityNotFoundException("해당하는 리뷰를 찾을 수 없습니다."));
}
Expand Down

0 comments on commit b77fc10

Please sign in to comment.