Skip to content

Commit

Permalink
feat : Review 관련 API 요청, 응답 DTO swagger 추가 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjKim1229 committed May 27, 2024
1 parent 4561495 commit 8ade689
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.clubber.ClubberServer.domain.club.domain.Club;
import com.clubber.ClubberServer.domain.review.domain.Keyword;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Map;
import lombok.AccessLevel;
import lombok.Builder;
Expand All @@ -10,8 +11,11 @@
@Getter
@Builder(access = AccessLevel.PRIVATE)
public class ClubReviewKeywordStatsResponse {
@Schema(description = "동아리 id", example = "1")
private final Long clubId;

@Schema(description = "작성한 리뷰 키워드",
example = "{\"CULTURE\": 10, \"FEE\": 20, \"ACTIVITY\": 30, \"CAREER\": 40, \"MANAGE\": 50}")
private final Map<Keyword, Long> keywordStats;

public static ClubReviewKeywordStatsResponse of (Club club, Map<Keyword, Long> keywordStats){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.clubber.ClubberServer.domain.review.domain.Review;
import com.clubber.ClubberServer.domain.review.domain.ReviewKeyword;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
Expand All @@ -16,19 +17,29 @@
@Getter
@Builder(access = AccessLevel.PRIVATE)
public class ClubReviewResponse {

@Schema(description = "동아리 id", example = "1")
private final Long clubId;

@Schema(description = "리뷰 목록")
private final List<ReviewResponse> reviews;

@Getter
@Builder(access = AccessLevel.PRIVATE)
private static class ReviewResponse{

@Schema(description = "리뷰 id", example = "1")
private final Long reviewId;

@Schema(description = "유저 id", example = "1")
private final Long userId;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy.MM.dd", timezone = "Asia/Seoul")
@Schema(description = "리뷰 작성 일자", example = "2024.01.01", type = "string")
private final LocalDateTime dateTime;

@Schema(description = "작성한 리뷰 키워드",
example = "[\"CULTURE\", \"FEE\", \"ACTIVITY\", \"CAREER\", \"MANAGE\"]")
private final List<Keyword> keywords;

public static ReviewResponse of(Review review, List<Keyword> keywords){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.clubber.ClubberServer.domain.review.domain.Review;
import com.clubber.ClubberServer.domain.review.domain.ReviewKeyword;
import com.clubber.ClubberServer.domain.user.domain.User;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AccessLevel;
Expand All @@ -16,8 +17,14 @@
@Builder(access = AccessLevel.PRIVATE)
public class ReviewCreateResponse {

@Schema(description = "유저 id", example = "1")
private final Long userId;

@Schema(description = "동아리 id", example = "1")
private final Long clubId;

@Schema(description = "작성한 리뷰 키워드",
example = "[\"CULTURE\", \"FEE\", \"ACTIVITY\", \"CAREER\", \"MANAGE\"]")
private final List<Keyword> keywords;

public static ReviewCreateResponse of(Review review, List<ReviewKeyword> reviewkeywords){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class ReviewRequest {

// @Schema(description = "선택한 리뷰 키워드들",
// example = "[\"CULTURE\", \"FEE\"]")
@Schema(description = "선택한 리뷰 키워드들",
example = "[\"CULTURE\", \"FEE\"]")
example = "[\"CULTURE\", \"FEE\", \"ACTIVITY\", \"CAREER\", \"MANAGE\"]")
@NotNull
@Size(min = 1, message = "하나 이상의 리뷰 키워드를 입력해주세요.")
private List<Keyword> keywords;
Expand Down

0 comments on commit 8ade689

Please sign in to comment.