Skip to content

Commit aedadf5

Browse files
authored
Merge pull request #72 from Decodeat/Refactor/#71
Refactor: 신고내역에 신고자 닉네임 추가
2 parents 8c3b7df + f68214e commit aedadf5

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/main/java/com/DecodEat/domain/report/converter/ReportConverter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ public static ReportResponseDto toReportResponseDto(Long productId, String type)
2323
.build();
2424
}
2525

26-
public static NutritionReport toNutritionReport(Long reporterId, Product product,ProductNutritionUpdateRequestDto requestDto){
26+
public static NutritionReport toNutritionReport(Long reporterId, String nickname, Product product,ProductNutritionUpdateRequestDto requestDto){
2727
return NutritionReport.builder()
2828
.product(product)
2929
.reporterId(reporterId)
30+
.nickname(nickname)
3031
.reportStatus(ReportStatus.IN_PROGRESS)
3132
.calcium(requestDto.getCalcium())
3233
.carbohydrate(requestDto.getCarbohydrate())
@@ -106,6 +107,7 @@ public static ReportResponseDto.ReportListItemDTO toReportListItemDTO(ReportReco
106107
ReportResponseDto.ReportListItemDTO.ReportListItemDTOBuilder builder = ReportResponseDto.ReportListItemDTO.builder()
107108
.reportId(reportRecord.getId())
108109
.reporterId(reportRecord.getReporterId())
110+
.nickname(reportRecord.getNickname())
109111
.productInfo(toSimpleProductInfoDTO(product))
110112
.currentNutritionInfo(toProductNutritionInfoDTO(currentNutrition))
111113
.reportStatus(reportRecord.getReportStatus())

src/main/java/com/DecodEat/domain/report/dto/response/ReportResponseDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public static class ReportListItemDTO {
8989
@Schema(description = "신고자 ID", example = "2")
9090
private Long reporterId;
9191

92+
@Schema(description = "신고자 닉네임", example = "닉네임")
93+
private String nickname;
94+
9295
@Schema(description = "신고된 상품 정보")
9396
private SimpleProductInfoDTO productInfo;
9497

src/main/java/com/DecodEat/domain/report/entity/ReportRecord.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public abstract class ReportRecord extends BaseEntity {
2929
@Column(nullable = false)
3030
private Long reporterId;
3131

32+
@Column(nullable = false)
33+
private String nickname;
34+
3235
@Enumerated(EnumType.STRING)
3336
@Column(nullable = false)
3437
@Schema(name = "처리 상태", example = "IN_PROGRESS")

src/main/java/com/DecodEat/domain/report/service/ReportService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public ReportResponseDto requestUpdateNutrition(User user, Long productId, Produ
3838

3939
Product productProxy = productRepository.getReferenceById(productId); //SELECT 쿼리 없이 ID만 가진 프록시 객체를 가져옴
4040

41-
nutritionReportRepository.save(ReportConverter.toNutritionReport(user.getId(), productProxy, requestDto));
41+
nutritionReportRepository.save(ReportConverter.toNutritionReport(user.getId(), user.getNickname(), productProxy, requestDto));
4242

4343
return ReportConverter.toReportResponseDto(productId,"상품 정보 업데이트 요청 완료");
4444
}

0 commit comments

Comments
 (0)