From be05af0d89a2daacc5b45ed57b359428f9f46df2 Mon Sep 17 00:00:00 2001 From: WonyuChoi Date: Sun, 13 Oct 2024 17:20:08 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8B=A0=EA=B3=A0=20=EC=8B=9C=EB=82=98?= =?UTF-8?q?=EB=A6=AC=EC=98=A4=EC=97=90=20content=20type=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flash/account/member/application/ReportService.java | 7 ++++--- .../member/application/dto/MemberReportRequest.java | 6 +++++- .../member/application/dto/MemberReportResponse.java | 9 ++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/first/flash/account/member/application/ReportService.java b/src/main/java/com/first/flash/account/member/application/ReportService.java index 67892ac8..bf7657c2 100644 --- a/src/main/java/com/first/flash/account/member/application/ReportService.java +++ b/src/main/java/com/first/flash/account/member/application/ReportService.java @@ -25,8 +25,9 @@ public MemberReportResponse reportMember(final Long reportedContentId, UUID reporterId = AuthUtil.getId(); Member reporter = memberService.findById(reporterId); MemberReport memberReport = MemberReport.reportContent(request.reason(), reporter, - reportedContentId); - reportRepository.save(memberReport); - return MemberReportResponse.toDto(reportedContentId, request.reason()); + reportedContentId, request.contentType()); + MemberReport savedReport = reportRepository.save(memberReport); + return MemberReportResponse.toDto(savedReport.getReportedContentId(), + savedReport.getContentType(), savedReport.getReason()); } } diff --git a/src/main/java/com/first/flash/account/member/application/dto/MemberReportRequest.java b/src/main/java/com/first/flash/account/member/application/dto/MemberReportRequest.java index 90ff2035..d9199d5b 100644 --- a/src/main/java/com/first/flash/account/member/application/dto/MemberReportRequest.java +++ b/src/main/java/com/first/flash/account/member/application/dto/MemberReportRequest.java @@ -1,7 +1,11 @@ package com.first.flash.account.member.application.dto; +import com.first.flash.account.member.domain.ContentType; +import com.first.flash.global.annotation.ValidEnum; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; -public record MemberReportRequest(@NotEmpty(message = "신고 사유는 필수입니다.") String reason) { +public record MemberReportRequest(@NotEmpty(message = "신고 사유는 필수입니다.") String reason, + @NotNull(message = "콘텐츠 타입은 필수입니다.") @ValidEnum(enumClass = ContentType.class) ContentType contentType) { } diff --git a/src/main/java/com/first/flash/account/member/application/dto/MemberReportResponse.java b/src/main/java/com/first/flash/account/member/application/dto/MemberReportResponse.java index 94e916dc..87923b55 100644 --- a/src/main/java/com/first/flash/account/member/application/dto/MemberReportResponse.java +++ b/src/main/java/com/first/flash/account/member/application/dto/MemberReportResponse.java @@ -1,8 +1,11 @@ package com.first.flash.account.member.application.dto; -public record MemberReportResponse(Long reportedContentId, String reason) { +import com.first.flash.account.member.domain.ContentType; - public static MemberReportResponse toDto(final Long reportedContentId, final String reason) { - return new MemberReportResponse(reportedContentId, reason); +public record MemberReportResponse(Long reportedContentId, String contentType, String reason) { + + public static MemberReportResponse toDto(final Long reportedContentId, + final ContentType contentType, final String reason) { + return new MemberReportResponse(reportedContentId, contentType.name(), reason); } }