-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from CELEBIT/feature/admin-migration
feat : admin migration
- Loading branch information
Showing
127 changed files
with
3,569 additions
and
190 deletions.
There are no files selected for viewing
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
3 changes: 3 additions & 0 deletions
3
sluv-admin/src/main/java/com/sluv/admin/AdminApplication.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
33 changes: 33 additions & 0 deletions
33
sluv-admin/src/main/java/com/sluv/admin/brand/controller/BrandDashBoardController.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,33 @@ | ||
package com.sluv.admin.brand.controller; | ||
|
||
import com.sluv.admin.brand.dto.HotBrandResDto; | ||
import com.sluv.admin.brand.service.BrandService; | ||
import com.sluv.admin.common.response.SuccessDataResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RequestMapping("/backoffice/item/dashBoard") | ||
public class BrandDashBoardController { | ||
|
||
private final BrandService brandService; | ||
|
||
@Operation( | ||
summary = "대시보드 - 인기 사용 브랜드 조회", | ||
description = "대시보드에서 가장 많이 사용된 브랜드 Top 3을 조회한다." | ||
) | ||
@GetMapping("/hotBrand") | ||
public ResponseEntity<SuccessDataResponse<List<HotBrandResDto>>> getHotBrand() { | ||
List<HotBrandResDto> response = brandService.getTop3HotBrand(); | ||
return ResponseEntity.ok().body(SuccessDataResponse.create(response)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
sluv-admin/src/main/java/com/sluv/admin/brand/dto/HotBrandResDto.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 com.sluv.admin.brand.dto; | ||
|
||
|
||
import com.sluv.domain.brand.entity.Brand; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class HotBrandResDto { | ||
private Long id; | ||
private String name; | ||
private String imgUrl; | ||
@Schema(description = "해당 Brand가 사용되는 횟수") | ||
private Long useCount; | ||
|
||
public static HotBrandResDto of(Brand brand, Long useCount) { | ||
return HotBrandResDto.builder() | ||
.id(brand.getId()) | ||
.name(brand.getBrandKr() + " (" + brand.getBrandEn() + ")") | ||
.imgUrl(brand.getBrandImgUrl()) | ||
.useCount(useCount) | ||
.build(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
sluv-admin/src/main/java/com/sluv/admin/brand/service/BrandService.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,20 @@ | ||
package com.sluv.admin.brand.service; | ||
|
||
import com.sluv.admin.brand.dto.HotBrandResDto; | ||
import com.sluv.domain.brand.service.BrandDomainService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class BrandService { | ||
private final BrandDomainService brandDomainService; | ||
|
||
public List<HotBrandResDto> getTop3HotBrand() { | ||
return brandDomainService.getTopHotBrandWithLimit(3).stream() | ||
.map(brandCountDto -> HotBrandResDto.of(brandCountDto.getBrand(), brandCountDto.getUseCount())) | ||
.toList(); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
sluv-admin/src/main/java/com/sluv/admin/comment/controller/CommentController.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,74 @@ | ||
package com.sluv.admin.comment.controller; | ||
|
||
import com.sluv.admin.comment.dto.CommentReportDetailResponse; | ||
import com.sluv.admin.comment.dto.CommentReportInfoDto; | ||
import com.sluv.admin.comment.dto.UpdateCommentReportResDto; | ||
import com.sluv.admin.comment.service.CommentReportService; | ||
import com.sluv.admin.common.response.ErrorResponse; | ||
import com.sluv.admin.common.response.PaginationResponse; | ||
import com.sluv.admin.common.response.SuccessDataResponse; | ||
import com.sluv.domain.common.enums.ReportStatus; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/backoffice/comment") | ||
public class CommentController { | ||
|
||
private final CommentReportService commentReportService; | ||
|
||
@Operation( | ||
summary = "댓글 신고 정보 조히", | ||
description = "WAITING, COMPLETED, REJECTED 로 검색 조건, 없으면 전체 검색" | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "1000", description = "요청성공"), | ||
@ApiResponse(responseCode = "5000", description = "서버내부 에러", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "5001", description = "DB 에러", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) | ||
}) | ||
@GetMapping("/report") | ||
public ResponseEntity<SuccessDataResponse<PaginationResponse<CommentReportInfoDto>>> getAllCommentReport(Pageable pageable, | ||
@RequestParam(required = false) ReportStatus reportStatus) { | ||
PaginationResponse<CommentReportInfoDto> response = commentReportService.getAllCommentReport(pageable, reportStatus); | ||
return ResponseEntity.ok().body(SuccessDataResponse.create(response)); | ||
} | ||
|
||
@Operation( | ||
summary = "댓글 신고 상세 정보 조히", | ||
description = "댓글 신고 id를 통해 댓글 신고 상세 정보 조회" | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "1000", description = "요청성공"), | ||
@ApiResponse(responseCode = "5000", description = "서버내부 에러", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "5001", description = "DB 에러", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) | ||
}) | ||
@GetMapping("/report/{commentReportId}") | ||
public ResponseEntity<SuccessDataResponse<CommentReportDetailResponse>> getCommentReportDetail(@PathVariable Long commentReportId) { | ||
CommentReportDetailResponse response = commentReportService.getCommentReportDetail(commentReportId); | ||
return ResponseEntity.ok().body(SuccessDataResponse.create(response)); | ||
} | ||
|
||
@Operation( | ||
summary = "댓글 신고 처리", | ||
description = "댓글 신고 id와 reportStatus(COMPLETED, REJECTED)를 통해 댓글 신고 처리" | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "1000", description = "요청성공"), | ||
@ApiResponse(responseCode = "5000", description = "서버내부 에러", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "5001", description = "DB 에러", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) | ||
}) | ||
@PostMapping("/report/{commentReportId}") | ||
public ResponseEntity<SuccessDataResponse<UpdateCommentReportResDto>> changeCommentReportStatus(@PathVariable Long commentReportId, | ||
@RequestParam ReportStatus reportStatus) { | ||
UpdateCommentReportResDto response = commentReportService.updateCommentReportStatus(commentReportId, reportStatus); | ||
return ResponseEntity.ok().body(SuccessDataResponse.create(response)); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
sluv-admin/src/main/java/com/sluv/admin/comment/controller/CommentDashBoardController.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,32 @@ | ||
package com.sluv.admin.comment.controller; | ||
|
||
import com.sluv.admin.comment.dto.CommentBlockCountResponse; | ||
import com.sluv.admin.comment.service.CommentService; | ||
import com.sluv.admin.common.response.SuccessDataResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RequestMapping("/backoffice/comment/dashBoard") | ||
public class CommentDashBoardController { | ||
|
||
private final CommentService commentService; | ||
|
||
@Operation( | ||
summary = "대시보드 - Block된 댓글 통계 조회", | ||
description = "대시보드에서 Block된 댓글 통계를 조회한다." | ||
) | ||
@GetMapping("/blockCount") | ||
public ResponseEntity<SuccessDataResponse<CommentBlockCountResponse>> getCommentBlockCount() { | ||
CommentBlockCountResponse response = commentService.getCommentBlockCount(); | ||
return ResponseEntity.ok().body(SuccessDataResponse.create(response)); | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
sluv-admin/src/main/java/com/sluv/admin/comment/dto/CommentBlockCountResponse.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,42 @@ | ||
package com.sluv.admin.comment.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.RoundingMode; | ||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class CommentBlockCountResponse { | ||
@Schema(description = "오늘 기준으로 한달전 대비 증가 비율") | ||
private Double percent; | ||
@Schema(description = "총 Block 댓글 수") | ||
private Long totalCount; | ||
@Schema(description = "이번주 기준으로 10주간 가입자 수 그래프") | ||
private List<Long> countGraph; | ||
|
||
public static CommentBlockCountResponse of(Long totalCount, Long recentMonthCount, List<Long> countGraph) { | ||
return CommentBlockCountResponse.builder() | ||
.percent(getPercent(recentMonthCount, totalCount)) | ||
.totalCount(totalCount) | ||
.countGraph(countGraph) | ||
.build(); | ||
} | ||
|
||
private static Double getPercent(Long recentCount, Long totalCount) { | ||
if (totalCount == 0) { | ||
return 0.0; | ||
} | ||
// 계산 후 소숫점 2자리까지 반올림1 | ||
return BigDecimal.valueOf((double) recentCount / totalCount * 100) | ||
.setScale(2, RoundingMode.HALF_UP) | ||
.doubleValue(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
sluv-admin/src/main/java/com/sluv/admin/comment/dto/CommentReportDetailResponse.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,51 @@ | ||
package com.sluv.admin.comment.dto; | ||
|
||
import com.sluv.domain.comment.entity.Comment; | ||
import com.sluv.domain.comment.entity.CommentReport; | ||
import com.sluv.domain.comment.enums.CommentReportReason; | ||
import com.sluv.domain.common.enums.ReportStatus; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CommentReportDetailResponse { | ||
|
||
private Long reporterId; | ||
private String reporterNickname; | ||
private Long reportedId; | ||
private String reportedNickname; | ||
private Long reportId; | ||
private CommentReportReason reportReason; | ||
@Schema(description = "신고 상세 내용") | ||
private String content; | ||
@Schema(description = "신고 접수 상태") | ||
private ReportStatus reportStatus; | ||
@Schema(description = "신고 당한 원본 댓글 내용") | ||
private String reportedCommentContent; | ||
private LocalDateTime createdAt; | ||
private LocalDateTime updatedAt; | ||
|
||
public static CommentReportDetailResponse of(CommentReport commentReport, Comment comment) { | ||
return CommentReportDetailResponse.builder() | ||
.reporterId(commentReport.getReporter().getId()) | ||
.reporterNickname(commentReport.getReporter().getNickname()) | ||
.reportedId(comment.getUser().getId()) | ||
.reportedNickname(comment.getUser().getNickname()) | ||
.reportReason(commentReport.getCommentReportReason()) | ||
.content(commentReport.getContent()) | ||
.reportStatus(commentReport.getReportStatus()) | ||
.reportedCommentContent(comment.getContent()) | ||
.createdAt(commentReport.getCreatedAt()) | ||
.updatedAt(commentReport.getUpdatedAt()) | ||
.build(); | ||
} | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
sluv-admin/src/main/java/com/sluv/admin/comment/dto/CommentReportInfoDto.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,50 @@ | ||
package com.sluv.admin.comment.dto; | ||
|
||
import com.sluv.domain.comment.entity.Comment; | ||
import com.sluv.domain.comment.entity.CommentReport; | ||
import com.sluv.domain.comment.enums.CommentReportReason; | ||
import com.sluv.domain.common.enums.ReportStatus; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CommentReportInfoDto { | ||
|
||
private Long reporterId; | ||
private String reporterNickname; | ||
private Long reportedId; | ||
private String reportedNickname; | ||
private Long reportId; | ||
@Schema(description = "댓글 신고 이유(enums)") | ||
private CommentReportReason reportReason; | ||
@Schema(description = "신고 상세 내용") | ||
private String content; | ||
@Schema(description = "신고 접수 상태") | ||
private ReportStatus reportStatus; | ||
private LocalDateTime createdAt; | ||
private LocalDateTime updatedAt; | ||
|
||
public static CommentReportInfoDto of(CommentReport commentReport, Comment comment) { | ||
return CommentReportInfoDto.builder() | ||
.reporterId(commentReport.getReporter().getId()) | ||
.reporterNickname(commentReport.getReporter().getNickname()) | ||
.reportedId(comment.getUser().getId()) | ||
.reportedNickname(comment.getUser().getNickname()) | ||
.reportId(commentReport.getId()) | ||
.reportReason(commentReport.getCommentReportReason()) | ||
.content(commentReport.getContent()) | ||
.reportStatus(commentReport.getReportStatus()) | ||
.createdAt(commentReport.getCreatedAt()) | ||
.updatedAt(commentReport.getUpdatedAt()) | ||
.build(); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
sluv-admin/src/main/java/com/sluv/admin/comment/dto/UpdateCommentReportResDto.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,20 @@ | ||
package com.sluv.admin.comment.dto; | ||
|
||
import com.sluv.domain.common.enums.ReportStatus; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class UpdateCommentReportResDto { | ||
|
||
private ReportStatus reportStatus; | ||
|
||
public static UpdateCommentReportResDto of(ReportStatus reportStatus) { | ||
return new UpdateCommentReportResDto( | ||
reportStatus | ||
); | ||
} | ||
} |
Oops, something went wrong.