Skip to content

Commit

Permalink
feature : spotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
Qbeom0925 committed Jan 10, 2024
1 parent 3ab3859 commit ccbacca
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 38 deletions.
5 changes: 1 addition & 4 deletions src/main/java/everymeal/server/review/entity/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
Expand All @@ -28,9 +27,7 @@ public class Image extends BaseEntity {

private Boolean isDeleted;

@ManyToOne
private Review review;

@ManyToOne private Review review;

@Builder
public Image(String imageUrl, Review review) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
@Repository
public interface ImageRepository extends JpaRepository<Image, Long> {

@Query(value = """
@Query(
value =
"""
SELECT i
FROM images i
LEFT JOIN reviews r ON i.review.idx = r.idx and r.store.idx = :storeIdx AND r.isDeleted = false
Expand All @@ -20,5 +22,4 @@ public interface ImageRepository extends JpaRepository<Image, Long> {
LIMIT 5
""")
List<Image> getStoreImages(@Param(value = "storeIdx") Long storeIdx);

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public ApplicationResponse<Page<StoreGetRes>> getStores(
title = "평점",
description = "평점",
allowableValues = {"1", "2", "3", "4", "5"})
Integer grade)
{
Integer grade) {

return ApplicationResponse.ok(
storeService.getStores(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public interface StoreService {

Page<StoreGetRes> getStores(
Long campusIdx, Pageable of, String group, Long userIdx, String order, Integer grade);
Long campusIdx, Pageable of, String group, Long userIdx, String order, Integer grade);

StoreGetRes getStore(Long storeIdx, Long userIdx);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public class StoreServiceImpl implements StoreService {

@Override
public Page<StoreGetRes> getStores(
Long campusIdx,
Pageable pageable,
String group,
Long userIdx,
String order,
Integer grade) {
Long campusIdx,
Pageable pageable,
String group,
Long userIdx,
String order,
Integer grade) {
List<Map<String, Object>> stores =
storeMapper.getStores(
campusIdx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ void getStoreDetail() throws Exception {

// when then
mockMvc.perform(get("/api/v1/stores/{storeIdx}", storeIdx))
.andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.message").value("OK"));
.andDo(MockMvcResultHandlers.print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.message").value("OK"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ void tearDown() {
storeRepository.deleteAll();
universityRepository.deleteAll();
userRepository.deleteAll();
// imageRepository.deleteAll();
// reviewRepository.deleteAll();
// imageRepository.deleteAll();
// reviewRepository.deleteAll();
}

@DisplayName("캠퍼스 기준 식당 가져오기")
Expand Down Expand Up @@ -262,14 +262,14 @@ void getStoreDetail() {
Review review = createReviewEntity(store, getUser(university, 1));
reviewRepository.save(review);

List<Image> images = List.of(
createImageEntity("1",review),
createImageEntity("2",review),
createImageEntity("3",review),
createImageEntity("4",review),
createImageEntity("5",review),
createImageEntity("6",review)
);
List<Image> images =
List.of(
createImageEntity("1", review),
createImageEntity("2", review),
createImageEntity("3", review),
createImageEntity("4", review),
createImageEntity("5", review),
createImageEntity("6", review));
imageRepository.saveAll(images);

entityManager.clear();
Expand All @@ -283,19 +283,11 @@ void getStoreDetail() {
}

private Image createImageEntity(String urlNumber, Review review) {
return Image.builder()
.imageUrl("url"+urlNumber)
.review(review)
.build();
return Image.builder().imageUrl("url" + urlNumber).review(review).build();
}

private Review createReviewEntity(Store store, User user) {
return Review.builder()
.store(store)
.user(user)
.content("content")
.grade(0)
.build();
return Review.builder().store(store).user(user).content("content").grade(0).build();
}

private Like createLikeEntity(Store store, User user) {
Expand Down

0 comments on commit ccbacca

Please sign in to comment.