From 8daf05efd1592955bb81c978722d856332b0bdc1 Mon Sep 17 00:00:00 2001 From: Jaewon Lee <58386334+jaewonLeeKOR@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:26:31 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20#159=20SliceResponse=20=EB=A7=A4?= =?UTF-8?q?=ED=8D=BC=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EB=8B=B5=EB=B3=80=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=95=20=EA=B5=AC=ED=98=84=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../capple/domain/answer/mapper/AnswerMapper.java | 14 -------------- .../domain/answer/service/AnswerServiceImpl.java | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/com/server/capple/domain/answer/mapper/AnswerMapper.java b/src/main/java/com/server/capple/domain/answer/mapper/AnswerMapper.java index 8cfd7293..400a4e83 100644 --- a/src/main/java/com/server/capple/domain/answer/mapper/AnswerMapper.java +++ b/src/main/java/com/server/capple/domain/answer/mapper/AnswerMapper.java @@ -1,6 +1,5 @@ package com.server.capple.domain.answer.mapper; -import com.server.capple.domain.answer.dao.AnswerRDBDao.AnswerInfoInterface; import com.server.capple.domain.answer.dto.AnswerRequest; import com.server.capple.domain.answer.dto.AnswerResponse.AnswerInfo; import com.server.capple.domain.answer.dto.AnswerResponse.AnswerList; @@ -9,8 +8,6 @@ import com.server.capple.domain.answer.entity.Answer; import com.server.capple.domain.member.entity.Member; import com.server.capple.domain.question.entity.Question; -import com.server.capple.global.common.SliceResponse; -import org.springframework.data.domain.Slice; import org.springframework.stereotype.Component; import java.util.List; @@ -62,15 +59,4 @@ public MemberAnswerInfo toMemberAnswerInfo(Answer answer, int heartCount, Boolea public MemberAnswerList toMemberAnswerList(List memberAnswerInfos) { return new MemberAnswerList(memberAnswerInfos); } - - public SliceResponse toAnswerInfoSliceResponse(Slice answerInfoSliceInterface, List content) { - return SliceResponse.builder() - .number(answerInfoSliceInterface.getNumber()) - .size(answerInfoSliceInterface.getSize()) - .content(content) - .numberOfElements(answerInfoSliceInterface.getNumberOfElements()) - .hasPrevious(answerInfoSliceInterface.hasPrevious()) - .hasNext(answerInfoSliceInterface.hasNext()) - .build(); - } } diff --git a/src/main/java/com/server/capple/domain/answer/service/AnswerServiceImpl.java b/src/main/java/com/server/capple/domain/answer/service/AnswerServiceImpl.java index 35a201e9..2d23c3af 100644 --- a/src/main/java/com/server/capple/domain/answer/service/AnswerServiceImpl.java +++ b/src/main/java/com/server/capple/domain/answer/service/AnswerServiceImpl.java @@ -97,7 +97,7 @@ public AnswerLike toggleAnswerHeart(Member loginMember, Long answerId) { public SliceResponse getAnswerList(Long memberId, Long questionId, Pageable pageable) { Slice answerInfoSliceInterface = answerRepository.findByQuestion(questionId, pageable).orElseThrow(() -> new RestApiException(AnswerErrorCode.ANSWER_NOT_FOUND)); - return answerMapper.toAnswerInfoSliceResponse(answerInfoSliceInterface, answerInfoSliceInterface.getContent().stream().map( + return SliceResponse.toSliceResponse(answerInfoSliceInterface, answerInfoSliceInterface.getContent().stream().map( answerInfoDto -> answerMapper.toAnswerInfo( answerInfoDto.getAnswer(), memberId,