-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/LIKELION-TEAM4-HACKATHON/ba…
…ck-end into fix-config-bug
- Loading branch information
Showing
17 changed files
with
283 additions
and
51 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/likelion/MZConnent/api/main/MainInfoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package likelion.MZConnent.api.main; | ||
|
||
import likelion.MZConnent.dto.main.response.MainInfoResponse; | ||
import likelion.MZConnent.service.main.MainInfoService; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class MainInfoController { | ||
private final MainInfoService mainInfoService; | ||
|
||
@GetMapping("/api/main") | ||
public ResponseEntity<MainInfoResponse> getMainInfo() { | ||
MainInfoResponse mainInfo = mainInfoService.getMainInfo(); | ||
log.info("메인 정보 조회: {}", mainInfo); | ||
|
||
return ResponseEntity.ok(mainInfo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/likelion/MZConnent/dto/main/response/MainInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package likelion.MZConnent.dto.main.response; | ||
|
||
import likelion.MZConnent.domain.club.Club; | ||
import likelion.MZConnent.domain.culture.Culture; | ||
import likelion.MZConnent.domain.review.Review; | ||
import likelion.MZConnent.dto.club.response.ClubSimpleResponse; | ||
import likelion.MZConnent.dto.culture.response.CulturesSimpleResponse; | ||
import likelion.MZConnent.dto.review.response.ReviewsSimpleResponse; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Data | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class MainInfoResponse { | ||
private List<CulturesSimpleResponse> popularCultures; | ||
private List<ReviewsSimpleResponse> popularReviews; | ||
private List<ClubSimpleResponse> recentClubs; | ||
|
||
@Builder | ||
public MainInfoResponse(List<Culture> popularCultures, List<Review> popularReviews, List<Club> recentClubs) { | ||
this.popularCultures = popularCultures.stream().map(culture -> CulturesSimpleResponse.builder().culture(culture).build()).collect(Collectors.toList()); | ||
this.popularReviews = popularReviews.stream().map(review -> ReviewsSimpleResponse.builder().review(review).build()).collect(Collectors.toList()); | ||
this.recentClubs = recentClubs.stream().map(ClubSimpleResponse::new).collect(Collectors.toList()); | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
src/main/java/likelion/MZConnent/dto/review/response/ReviewDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package likelion.MZConnent.dto.review.response; | ||
|
||
import likelion.MZConnent.domain.culture.Culture; | ||
import likelion.MZConnent.domain.review.Review; | ||
import likelion.MZConnent.domain.review.ReviewComment; | ||
import likelion.MZConnent.dto.member.MemberProfileDto; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class ReviewDetailResponse { | ||
private Long reviewId; | ||
private MemberProfileDto reviewer; | ||
private CultureSimpleDto culture; | ||
private String title; | ||
private String reviewImageUrl1; | ||
private String reviewImageUrl2; | ||
private String reviewImageUrl3; | ||
private String reviewImageUrl4; | ||
private String content; | ||
private LocalDateTime createdDate; | ||
private int likeCount; | ||
private List<CommentSimpleDto> comments = new ArrayList<CommentSimpleDto>(); | ||
|
||
@Builder | ||
public ReviewDetailResponse(Review review) { | ||
this.reviewId = review.getReviewId(); | ||
this.reviewer = MemberProfileDto.builder().member(review.getMember()).build(); | ||
this.culture = CultureSimpleDto.builder().culture(review.getCulture()).build(); | ||
this.title = review.getTitle(); | ||
this.reviewImageUrl1 = review.getReviewImageUrl1(); | ||
this.reviewImageUrl2 = review.getReviewImageUrl2(); | ||
this.reviewImageUrl3 = review.getReviewImageUrl3(); | ||
this.reviewImageUrl4 = review.getReviewImageUrl4(); | ||
this.content = review.getContent(); | ||
this.createdDate = review.getCreatedDate(); | ||
this.likeCount = review.getLikeCount(); | ||
this.comments = review.getReviewComments().stream() | ||
.map(CommentSimpleDto::new).collect(Collectors.toList()); | ||
} | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
private static class CultureSimpleDto { | ||
private Long cultureId; | ||
private String name; | ||
|
||
@Builder | ||
public CultureSimpleDto(Culture culture) { | ||
this.cultureId = culture.getCultureId(); | ||
this.name = culture.getName(); | ||
} | ||
} | ||
|
||
@Getter | ||
@ToString | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
private static class CommentSimpleDto { | ||
private Long commentId; | ||
private MemberProfileDto commenter; | ||
private String content; | ||
|
||
@Builder | ||
public CommentSimpleDto(ReviewComment comment) { | ||
this.commentId = comment.getCommentId(); | ||
this.commenter = MemberProfileDto.builder().member(comment.getMember()).build(); | ||
this.content = comment.getContent(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/likelion/MZConnent/repository/review/ReviewCommentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
package likelion.MZConnent.repository.review; | ||
|
||
import likelion.MZConnent.domain.review.Review; | ||
import likelion.MZConnent.domain.review.ReviewComment; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface ReviewCommentRepository extends JpaRepository<ReviewComment, Long> { | ||
List<ReviewComment> findAllByReview(Review review); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.