Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public static ReportResponseDto toReportResponseDto(Long productId, String type)
.build();
}

public static NutritionReport toNutritionReport(Long reporterId, Product product,ProductNutritionUpdateRequestDto requestDto){
public static NutritionReport toNutritionReport(Long reporterId, String nickname, Product product,ProductNutritionUpdateRequestDto requestDto){
return NutritionReport.builder()
.product(product)
.reporterId(reporterId)
.nickname(nickname)
.reportStatus(ReportStatus.IN_PROGRESS)
.calcium(requestDto.getCalcium())
.carbohydrate(requestDto.getCarbohydrate())
Expand Down Expand Up @@ -106,6 +107,7 @@ public static ReportResponseDto.ReportListItemDTO toReportListItemDTO(ReportReco
ReportResponseDto.ReportListItemDTO.ReportListItemDTOBuilder builder = ReportResponseDto.ReportListItemDTO.builder()
.reportId(reportRecord.getId())
.reporterId(reportRecord.getReporterId())
.nickname(reportRecord.getNickname())
.productInfo(toSimpleProductInfoDTO(product))
.currentNutritionInfo(toProductNutritionInfoDTO(currentNutrition))
.reportStatus(reportRecord.getReportStatus())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public static class ReportListItemDTO {
@Schema(description = "신고자 ID", example = "2")
private Long reporterId;

@Schema(description = "신고자 닉네임", example = "닉네임")
private String nickname;

@Schema(description = "신고된 상품 정보")
private SimpleProductInfoDTO productInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public abstract class ReportRecord extends BaseEntity {
@Column(nullable = false)
private Long reporterId;

@Column(nullable = false)
private String nickname;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
@Schema(name = "처리 상태", example = "IN_PROGRESS")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ReportResponseDto requestUpdateNutrition(User user, Long productId, Produ

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

nutritionReportRepository.save(ReportConverter.toNutritionReport(user.getId(), productProxy, requestDto));
nutritionReportRepository.save(ReportConverter.toNutritionReport(user.getId(), user.getNickname(), productProxy, requestDto));

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