Skip to content

Commit

Permalink
[Refactor] AI진단 API response값 수정
Browse files Browse the repository at this point in the history
진단 결과 id도 반환하도록 수정함
  • Loading branch information
0-x-14 committed Aug 21, 2024
1 parent e96f816 commit ecf58f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import java.util.List;

public record PostDiagnoseResponseDTO(Integer score, String result_detail, String result_care, List<String> products) {
public record PostDiagnoseResponseDTO(Long result_id, Integer score, String result_detail, String result_care, List<String> products) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public PostDiagnoseResponseDTO postDiagnoseByRecord(Long memberId, PostDiagnoseR
// 결과 저장
Result savedResult = resultRepository.save(result);

Long resultId = savedResult.getResultId();

// DTO에 제품명 반환을 위해 products 리스트 구성
List<String> products = new ArrayList<>();
products.add(product1);
Expand All @@ -144,7 +146,7 @@ public PostDiagnoseResponseDTO postDiagnoseByRecord(Long memberId, PostDiagnoseR
products.add(product4);
products.add(product5);

return new PostDiagnoseResponseDTO(score, detail, care, products);
return new PostDiagnoseResponseDTO(resultId, score, detail, care, products);
} catch (NoSuchElementException e) {
e.printStackTrace();
log.error("데이터 조회에 실패했습니다." + e.getMessage(), e);
Expand Down

0 comments on commit ecf58f2

Please sign in to comment.