Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev -> main #595

Merged
merged 95 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
b19f62a
test : 모집글 controller 테스트 코드 작성 (#543)
sseongeun Jan 9, 2025
e254eac
refactor : user 조회용 서비스 분리 (#575)
mjKim1229 Jan 16, 2025
fadf3a6
refactor : UserReadService에서 조회 하게 수정 (#575)
mjKim1229 Jan 16, 2025
515f131
refactor : favorite 조회 soft delete 컬럼 누락 (#575)
mjKim1229 Jan 16, 2025
cdb8538
feat : AdminReadService에서 Admin 조회 함수 구현 (#575)
mjKim1229 Jan 16, 2025
b5ec709
refactor : AdminReadService에서 관리자 조회 (#575)
mjKim1229 Jan 16, 2025
dff8314
fix : 함수명 수정 (#575)
mjKim1229 Jan 16, 2025
feb2911
refactor : review Deleted 필터링 쿼리 추가 (#575)
mjKim1229 Jan 16, 2025
227709c
refactor : JwtTokenService로 분리하여 JwtTokenProvider와 authservice 의존성 감소…
mjKim1229 Jan 16, 2025
80df1c1
refactor : Favorite Validator 구현 (#575)
mjKim1229 Jan 16, 2025
77b2a1f
fix : 삭제 컬럼 누락 (#575)
mjKim1229 Jan 16, 2025
034cf5b
Merge pull request #576 from Clubber2024/refactor/#575-refactor-auths…
mjKim1229 Jan 16, 2025
80213cf
refactor : final + schema 추가 (#566)
sseongeun Jan 17, 2025
091a23c
feat : title,content 빈문자열인 경우 test 추가 (#543)
sseongeun Jan 17, 2025
ef23411
refactor : 누락된 schema 추가 (#566)
sseongeun Jan 17, 2025
4466f12
refactor : imageurl예시값 수정 (#566)
sseongeun Jan 17, 2025
0a33885
Merge pull request #577 from Clubber2024/refactor/#566-response-dto-필…
sseongeun Jan 17, 2025
74311e5
Merge branch 'dev' of https://github.com/Clubber2024/Clubber-Server i…
sseongeun Jan 17, 2025
845ed39
feat : 테스트 케이스 정리 (#543)
sseongeun Jan 17, 2025
a743d6b
Merge pull request #578 from Clubber2024/feat/#543-recruit-테스트-코드
sseongeun Jan 17, 2025
4ba5a55
refactor : @NotNull 어노테이션 제거 (#579)
sseongeun Jan 17, 2025
3cab419
Merge pull request #580 from Clubber2024/refactor/#579-recruit-dto--n…
sseongeun Jan 17, 2025
2669085
chore : 패키지 구조 변경 (#582)
mjKim1229 Jan 18, 2025
4ee38df
refactor : final + schema 추가 (#581)
sseongeun Jan 18, 2025
671d867
Merge pull request #583 from Clubber2024/refactor/#581-club-도메인-관련-dt…
sseongeun Jan 18, 2025
df1b796
refactor : 도메인 정책은 엔티티 내에서 정의하고 dto 내에서의 비즈니스 로직 삭제 (#582)
mjKim1229 Jan 18, 2025
d4c51ba
chore : 패키지 구조 변경 및 불필요한 코드 삭제 (#582)
mjKim1229 Jan 18, 2025
b1face0
refactor : 리뷰 작성 response mapper 적용 (#582)
mjKim1229 Jan 18, 2025
057f467
refactor : user 리뷰 조회 mapper 적용 (#582)
mjKim1229 Jan 18, 2025
f1605aa
refactor : admin 리뷰 조회 mapper 적용 (#582)
mjKim1229 Jan 18, 2025
6c76dc8
refactor : 동아리 별 리뷰 페이지 조회 mapper 적용 (#582)
mjKim1229 Jan 19, 2025
24d6b53
refactor : 리뷰 조회 Slice 방식 mapper 적용 (#582)
mjKim1229 Jan 19, 2025
e15659e
test : 리뷰 승인 상태가 아닐 경우의 단위 테스트 (#582)
mjKim1229 Jan 19, 2025
e6d2138
test : 리뷰 승인 상태일 경우 기존 content 댓글이 반환된다. (#582)
mjKim1229 Jan 19, 2025
95440c5
refactor : keyword 추출 공통 함수 리팩토링 (#582)
mjKim1229 Jan 19, 2025
840c815
refactor : reviewUtil로 함수 분리 (#582)
mjKim1229 Jan 19, 2025
a722e2e
refactor : 함수 위치 변경 (#582)
mjKim1229 Jan 19, 2025
e7aa9a0
refactor : 파일 명 변경 및 내부 클래스 추출 (#582)
mjKim1229 Jan 19, 2025
4d3bf56
chore : import 정리 (#582)
mjKim1229 Jan 19, 2025
bc7f73b
chore : 패키지 이동 (#582)
mjKim1229 Jan 19, 2025
55cb7ec
refactor : 클래스 명 변경 및 이전 dto 삭제 (#582)
mjKim1229 Jan 19, 2025
3e23269
refactor : 클래스 명 변경 (#582)
mjKim1229 Jan 19, 2025
963c947
refactor : 함수명 수정 (#582)
mjKim1229 Jan 19, 2025
947bb65
chore : 변수명 변경 (#582)
mjKim1229 Jan 19, 2025
7013c60
refactor : 함수명 변경 (#582)
mjKim1229 Jan 19, 2025
4a18962
refactor : 승인 대기 리뷰 리스트 조회 mapper 적용 (#582)
mjKim1229 Jan 19, 2025
ef5f994
refactor : 관리자 대기 리뷰 no - offset mapper 적용 (#582)
mjKim1229 Jan 19, 2025
c453a73
refactor : 도메인 별 클래스 분리 (#582)
mjKim1229 Jan 19, 2025
6d7fcee
refactor : 도메인 별 클래스 분리 (#582)
mjKim1229 Jan 19, 2025
4171260
fix : 오타 수정 (#582)
mjKim1229 Jan 20, 2025
d09da9e
test : 관리자 수동 승인 도메인 로직 테스트 코드 작성 (#582)
mjKim1229 Jan 20, 2025
8443d60
refactor : 승인 상태 리스트 추출 메서드 구현 (#582)
mjKim1229 Jan 20, 2025
2b97da3
refactor : assertall 삭제 및 stream & assert 단건으로 수정 (#582)
mjKim1229 Jan 20, 2025
927d71a
Merge branch 'dev' of https://github.com/Clubber2024/Clubber-Server i…
mjKim1229 Jan 20, 2025
979816f
fix : 충돌 해결 (#582)
mjKim1229 Jan 20, 2025
ba5912c
test : 자동 승인 도메인 로직 테스트 코드 (#582)
mjKim1229 Jan 20, 2025
21270d4
test : review 생성 시 공백값인 경우 테스트 코드 (#582)
mjKim1229 Jan 20, 2025
8132f75
refactor : 삼중 연산자 제거 (#582)
mjKim1229 Jan 20, 2025
b6ad0b6
refactor : ReviewUtil로 빈 값 체크 함수 분리 (#582)
mjKim1229 Jan 20, 2025
c6dd78a
feat : 이미 삭제된 리뷰 삭제 시 예외 추가 (#582)
mjKim1229 Jan 20, 2025
a79dabd
test : 이미 삭제된 리뷰 테스트 코드 (#582)
mjKim1229 Jan 20, 2025
b8a7b19
test : 삭제 상태가 아닌 리뷰의 삭제 테스트 코드 (#582)
mjKim1229 Jan 20, 2025
a2f9f92
refactor : soft delete 누락 해결 하기 위해 exists 함수 querydsl로 구현 (#582)
mjKim1229 Jan 20, 2025
31e5451
refactor : soft delete 컬럼 누락 수정 (#582)
mjKim1229 Jan 20, 2025
b33ab83
fix : soft - delete 누락 (#582)
mjKim1229 Jan 20, 2025
a7fda03
refactor : 공지사항 관련 dto- final,schema 추가 (#585)
sseongeun Jan 21, 2025
ba7649a
feat : notice mapper 추가 (#585)
sseongeun Jan 21, 2025
c31110a
refactor : 엔티티 생성시 컬럼 누락 추가 (#582)
mjKim1229 Jan 23, 2025
0d3b0ef
test : 리뷰 키워드 통계 단위 테스트 초기 구현 (#582)
mjKim1229 Jan 23, 2025
5fab91b
fix : 함수 및 stub 오류 수정 (#582)
mjKim1229 Jan 23, 2025
fd54a12
test : assertAll로 전체 케이스 검증 (#582)
mjKim1229 Jan 23, 2025
19947ae
refactor : 동아리별 리뷰 키워드 mapper로 분리 (#582)
mjKim1229 Jan 23, 2025
29740f7
refactor : ReviewServiceTest에서는 keyword 변환 로직만 검증 (#582)
mjKim1229 Jan 23, 2025
326ca9b
chore : indent 조정 (#582)
mjKim1229 Jan 23, 2025
6802854
refactor : 파일 이름 및 패키지 변경 (#582)
mjKim1229 Jan 23, 2025
35738a4
refactor : 파일, 패키지 명 변경 (#582)
mjKim1229 Jan 23, 2025
6d1ed96
refactor : 파일명 변경 (#582)
mjKim1229 Jan 23, 2025
07cac19
chore : 안쓰는 함수 삭제 (#582)
mjKim1229 Jan 23, 2025
6e867e7
refactor : 함수명 변경 (#582)
mjKim1229 Jan 23, 2025
a5aec2e
chore : indent 조정 (#582)
mjKim1229 Jan 23, 2025
64f9398
refactor : util성 클래스의 생성자를 private으로 변경하고 빈 등록을 하지 않게 수정 (#582)
mjKim1229 Jan 23, 2025
b55bd0a
chore : indent 기타 조정 (#582)
mjKim1229 Jan 23, 2025
4097fc6
chore : 안쓰는 함수 삭제 및 indent 수정 (#582)
mjKim1229 Jan 23, 2025
ede8633
refactor : 리뷰 - 리뷰 키워드 객체 생성 및 양방향 매핑 작업을 mapper에서 처리 (#582)
mjKim1229 Jan 23, 2025
ef5bfe1
chore : 함수명 및 indent 조정 (#582)
mjKim1229 Jan 23, 2025
cfe1490
refactor : 함수명 변경 (#582)
mjKim1229 Jan 23, 2025
ca947c6
refactor : Review 객체의 응집성을 고려해 (keyword 무조건 포함) 양방향 메서드는 Review 엔티티에서…
mjKim1229 Jan 23, 2025
cf4e9d8
refactor : Review의 매핑 및 생성은 mapper에서까지 할 필요성은 적다고 판단하여 삭제 (#582)
mjKim1229 Jan 23, 2025
b2d1633
refactor : Assertj 사용 (#582)
mjKim1229 Jan 23, 2025
9c8c5d8
refactor : assertj 적용 (#582)
mjKim1229 Jan 23, 2025
6db4df4
fix : 함수 잘못 사용 수정 (#582)
mjKim1229 Jan 23, 2025
13a1874
Merge pull request #588 from Clubber2024/refactor/#585-notice-관련-dto-…
mjKim1229 Jan 23, 2025
5073310
Merge pull request #584 from Clubber2024/refactor/#582-refactor-revie…
mjKim1229 Jan 23, 2025
a08c305
feat : cicd, docker-compose, dockerfile 생성 및 수정 (#589)
sseongeun Jan 23, 2025
b4045b2
Merge pull request #594 from Clubber2024/feat/#589-운영서버-해외-ip-차단-작업
sseongeun Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ jobs:
docker build -f Dockerfile.prod -t ${{ secrets.DOCKER_REPO }}/clubber-backend-prod .
docker push ${{ secrets.DOCKER_REPO }}/clubber-backend-prod

- name: docker build and push to prod nginx
if: contains(github.ref, 'main')
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile.nginx.prod -t ${{ secrets.DOCKER_REPO }}/clubber-nginx-prod .
docker push ${{ secrets.DOCKER_REPO }}/clubber-nginx-prod

- name: Copy docker-compose.yml to EC2 DEV
if: contains(github.ref, 'dev')
uses: appleboy/scp-action@master
Expand Down Expand Up @@ -126,5 +133,6 @@ jobs:
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/clubber-backend-prod
sudo docker pull ${{ secrets.DOCKER_REPO }}/clubber-front-prod
sudo docker pull ${{ secrets.DOCKER_REPO }}/clubber-nginx-prod
sudo docker-compose -f docker-compose-prod.yml up -d
sudo docker image prune -f
43 changes: 43 additions & 0 deletions Dockerfile.nginx.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Use the official NGINX base image
FROM nginx:1.24.0

# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
curl \
build-essential \
libpcre3-dev \
zlib1g-dev \
libmaxminddb-dev \
git \
&& rm -rf /var/lib/apt/lists/*

# Download and extract NGINX source code
ARG NGINX_VERSION=1.24.0
WORKDIR /usr/src
RUN wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxvf nginx-${NGINX_VERSION}.tar.gz && \
rm nginx-${NGINX_VERSION}.tar.gz

# Clone ngx_http_geoip2_module
RUN git clone https://github.com/leev/ngx_http_geoip2_module.git

# Build NGINX with geoip2 module
WORKDIR /usr/src/nginx-${NGINX_VERSION}
RUN ./configure \
--with-compat \
--add-dynamic-module=../ngx_http_geoip2_module && \
make modules

# Copy the built module to the NGINX modules directory
RUN mkdir -p /usr/lib/nginx/modules/
RUN cp objs/ngx_http_geoip2_module.so /usr/lib/nginx/modules/

# Clean up
RUN apt-get purge -y --auto-remove \
wget \
curl \
build-essential \
git && \
rm -rf /usr/src/*
3 changes: 2 additions & 1 deletion docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ services:

nginx:
container_name: nginx
image: nginx:latest
image: ssuclubber/clubber-nginx-prod
environment:
- TZ=Asia/Seoul
volumes:
- ./nginx/:/etc/nginx/
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
- /var/lib/GeoIP/GeoLite2-Country.mmdb:/var/lib/GeoIP/GeoLite2-Country.mmdb
ports:
- "80:80"
- "443:443"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.clubber.ClubberServer.domain.admin.dto.GetAdminPendingReviewsWithSliceResponse;
import com.clubber.ClubberServer.domain.admin.dto.GetAdminsReviewByStatusResponse;
import com.clubber.ClubberServer.domain.admin.dto.GetAdminPendingReviewsSliceResponse;
import com.clubber.ClubberServer.domain.admin.dto.GetAdminsPendingReviews;
import com.clubber.ClubberServer.domain.admin.dto.GetAdminsReviewsResponse;
import com.clubber.ClubberServer.domain.admin.dto.UpdateAdminsReviewApprovedStatusResponse;
import com.clubber.ClubberServer.domain.admin.dto.UpdateAdminsReviewStatusRequest;
import com.clubber.ClubberServer.domain.admin.dto.UpdateAdminsReviewApprovedStatusRequest;
import com.clubber.ClubberServer.domain.admin.service.AdminReviewService;

import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -33,22 +33,23 @@ public class AdminReviewController {

@Operation(summary = "동아리 계정에서 승인 대기 목록 조회", description = "승인 대기 중인 리뷰의 한줄평 목록 반환")
@GetMapping("/pending")
public List<GetAdminsReviewByStatusResponse> getAdminReviewsByApprovedStatus() {
return adminReviewService.getAdminReviewsByApprovedStatus();
public List<GetAdminsPendingReviews> getAdminPendingReviews() {
return adminReviewService.getAdminPendingReviews();
}

@Operation(summary = "동아리 계정에서 승인 대기 목록 조회 (더보기)", description = "추후 적용해주세요")
@GetMapping("/pending/slice")
public GetAdminPendingReviewsWithSliceResponse getAdminPendingReviewsWithSliceResponses(
public GetAdminPendingReviewsSliceResponse getAdminPendingReviewsWithSliceResponses(
@PageableDefault Pageable pageable, @RequestParam(required = false) Long lastReviewId){
return adminReviewService.getAdminPendingReviewsWithSliceResponse(pageable, lastReviewId);
}

@Operation(summary = "동아리 계정에서 리뷰 승인 / 거절 요청")
@PatchMapping("/decision")
public UpdateAdminsReviewApprovedStatusResponse updateAdminsReviewsApprovedStatusResponse(@Valid @RequestBody
UpdateAdminsReviewStatusRequest updateAdminsReviewStatusRequest) {
return adminReviewService.updateAdminsReviewsApprovedStatus(updateAdminsReviewStatusRequest);
UpdateAdminsReviewApprovedStatusRequest updateAdminsReviewApprovedStatusRequest) {
return adminReviewService.updateAdminsReviewsApprovedStatus(
updateAdminsReviewApprovedStatusRequest);
}

@Operation(summary = "동아리 계정 마이페이지 리뷰 목록")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.clubber.ClubberServer.domain.review.dto;

import java.time.LocalDateTime;
import java.util.Set;
package com.clubber.ClubberServer.domain.admin.dto;

import com.clubber.ClubberServer.domain.review.domain.ApprovedStatus;
import com.clubber.ClubberServer.domain.review.domain.Keyword;
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.Set;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -18,32 +14,32 @@
@Getter
@Builder(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class ClubReviewsWithContentDetailResponse {
public class AdminReviewResponse {

@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 = "APPROVED")
private final ApprovedStatus approvedStatus;

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

@Schema(description = "해당 동아리 된 한줄평 중 승인된 한줄평의 내용", example = "활동이 재밌어요")
@Schema(description = "리뷰 한줄평", example = "분위기가 좋아요")
private final String content;

public static ClubReviewsWithContentDetailResponse of(Review review) {
return ClubReviewsWithContentDetailResponse.builder()
.keywords(ReviewKeyword.from(review.getReviewKeywords()))
@Schema(description = "리뷰 작성 일자", example = "2024.01.01", type = "string")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy.MM.dd", timezone = "Asia/Seoul")
private final LocalDateTime dateTime;

public static AdminReviewResponse of(Review review, Set<String> keywords) {
return AdminReviewResponse.builder()
.reviewId(review.getId())
.userId(review.getUser().getId())
.approvedStatus(review.getApprovedStatus())
.keywords(keywords)
.content(review.getContent())
.dateTime(review.getCreatedAt())
.content(review.getApprovedStatus() == ApprovedStatus.APPROVED ? review.getContent() : null)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.clubber.ClubberServer.domain.admin.dto;

import com.clubber.ClubberServer.global.common.slice.SliceResponse;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class GetAdminPendingReviewsSliceResponse {

private final Long lastReviewId;

private final SliceResponse<GetAdminsPendingReviews> reviews;

public static GetAdminPendingReviewsSliceResponse of(SliceResponse<GetAdminsPendingReviews> reviews, Long lastReviewId){
return GetAdminPendingReviewsSliceResponse.builder()
.lastReviewId(lastReviewId)
.reviews(reviews)
.build();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.clubber.ClubberServer.domain.admin.dto;

import com.clubber.ClubberServer.domain.review.domain.Keyword;
import com.clubber.ClubberServer.domain.review.domain.Review;
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.stream.Collectors;
Expand All @@ -16,7 +14,7 @@
@Getter
@Builder(access = AccessLevel.PRIVATE)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class GetAdminsReviewByStatusResponse {
public class GetAdminsPendingReviews {

@Schema(description = "리뷰 id", example = "1")
private final Long reviewId;
Expand All @@ -29,15 +27,8 @@ public class GetAdminsReviewByStatusResponse {
@Schema(description = "한줄평", example = "분위기가 좋아요")
private final String content;

public static List<GetAdminsReviewByStatusResponse> from(List<Review> reviews){
return reviews.stream()
.map((r) ->GetAdminsReviewByStatusResponse.from(r))
.collect(Collectors.toList());

}

private static GetAdminsReviewByStatusResponse from(Review review){
return GetAdminsReviewByStatusResponse.builder()
public static GetAdminsPendingReviews from(Review review){
return GetAdminsPendingReviews.builder()
.reviewId(review.getId())
.writtenDate(review.getCreatedAt())
.content(review.getContent())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
package com.clubber.ClubberServer.domain.admin.dto;

import java.time.LocalDateTime;
import java.util.Set;

import org.springframework.data.domain.Page;

import com.clubber.ClubberServer.domain.admin.domain.Admin;
import com.clubber.ClubberServer.domain.club.domain.Club;
import com.clubber.ClubberServer.domain.review.domain.ApprovedStatus;
import com.clubber.ClubberServer.domain.review.domain.Review;
import com.clubber.ClubberServer.domain.review.domain.ReviewKeyword;
import com.clubber.ClubberServer.global.common.page.PageResponse;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -34,47 +24,14 @@ public class GetAdminsReviewsResponse {
private final String clubName;

@Schema(description = "리뷰 목록")
private final PageResponse<GetAdminsReviewDetailsResponse> clubReviews;

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

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

@Schema(description = "리뷰 상태", example = "APPROVED")
private final ApprovedStatus approvedStatus;

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

@Schema(description = "리뷰 한줄평", example = "분위기가 좋아요")
private final String content;

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

private static GetAdminsReviewDetailsResponse from(Review review) {
return GetAdminsReviewDetailsResponse.builder()
.reviewId(review.getId())
.approvedStatus(review.getApprovedStatus())
.keywords(ReviewKeyword.from(review.getReviewKeywords()))
.content(review.getContent())
.dateTime(review.getCreatedAt())
.build();
}
}
private final PageResponse<AdminReviewResponse> clubReviews;

public static GetAdminsReviewsResponse of(Admin admin, Club club, Page<Review> reviews) {
public static GetAdminsReviewsResponse of(Admin admin, Club club, PageResponse<AdminReviewResponse> clubReviews) {
return GetAdminsReviewsResponse.builder()
.adminId(admin.getId())
.clubId(club.getId())
.clubName(club.getName())
.clubReviews(PageResponse.of(reviews.map(GetAdminsReviewDetailsResponse::from)))
.clubReviews(clubReviews)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.util.List;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
@NoArgsConstructor
public class UpdateAdminsReviewStatusRequest {
public class UpdateAdminsReviewApprovedStatusRequest {

@Size(min = 1, message = "1개 이상 수정해야합니다")
@Size(max = 10, message = "10개 이하로 수정해야합니다.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.clubber.ClubberServer.domain.admin.dto;


import com.clubber.ClubberServer.domain.admin.domain.Admin;
import com.clubber.ClubberServer.domain.review.domain.ApprovedStatus;
import com.clubber.ClubberServer.domain.review.domain.Review;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
Loading
Loading