Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] : 가장 최근에 생성된 페르소나만 반환하도록 수정 #46

Merged
merged 2 commits into from
May 19, 2024
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
@@ -1,7 +1,6 @@
package kusitms.jangkku.domain.persona.application;

import kusitms.jangkku.domain.clova.application.ClovaService;
import kusitms.jangkku.domain.clova.application.ClovaServiceImpl;
import kusitms.jangkku.domain.persona.constant.DesignStage;
import kusitms.jangkku.domain.persona.dao.*;
import kusitms.jangkku.domain.persona.domain.*;
Expand Down Expand Up @@ -58,7 +57,7 @@ public DesignPersonaDto.DesignPersonaDetailResponse getDesignPersona(String auth
User user = userRepository.findByUserId(userId)
.orElseThrow(() -> new UserException(UserErrorResult.NOT_FOUND_USER));

DesignPersona designPersona = designPersonaRepository.findByUser(user);
DesignPersona designPersona = designPersonaRepository.findFirstByUserOrderByCreatedDateDesc(user);
List<DesignPersonaField> designPersonaFields = designPersonaFieldRepository.findAllByDesignPersona(designPersona);
List<DesignPersonaDistinction> designPersonaDistinctions = designPersonaDistinctionRepository.findAllByDesignPersona(designPersona);
List<DesignPersonaAbility> designPersonaAbilities = designPersonaAbilityRepository.findAllByDesignPersona(designPersona);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public DiscoverPersonaDto.QuestionResponse getNewQuestion(String authorizationHe
.build();
discoverPersonaChattingRepository.save(newDiscoverPersonaChatting);

return DiscoverPersonaDto.QuestionResponse.of(newDiscoverPersonaChatting.getId(), newQuestionContent);
return DiscoverPersonaDto.QuestionResponse.of(newDiscoverPersonaChatting.getId(), newQuestionContent, discoverPersona.getIsComplete());
}

// 공감과 요약을 생성해 응답하는 메서드
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
import org.springframework.data.jpa.repository.JpaRepository;

public interface DesignPersonaRepository extends JpaRepository<DesignPersona,Long> {
DesignPersona findByUser(User user);
DesignPersona findFirstByUserOrderByCreatedDateDesc(User user);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

public class DiscoverPersonaDto {
@Builder
@Getter
Expand All @@ -20,11 +18,14 @@ public class DiscoverPersonaDto {
public static class QuestionResponse {
private Long chattingId;
private String question;
private Boolean isComplete;


public static DiscoverPersonaDto.QuestionResponse of(Long chattingId, String question) {
public static DiscoverPersonaDto.QuestionResponse of(Long chattingId, String question, Boolean isComplete) {
return DiscoverPersonaDto.QuestionResponse.builder()
.chattingId(chattingId)
.question(question)
.isComplete(isComplete)
.build();
}
}
Expand Down
Loading