Skip to content

Commit

Permalink
fix : dto 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungGyo-00 committed Feb 1, 2024
1 parent 96a6e08 commit 5c8ae65
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
package com.example.reddiserver.dto.chatgpt.response;

import com.example.reddiserver.entity.Prompt;
import lombok.Builder;
import lombok.Getter;

import java.util.LinkedHashMap;
import java.util.Map;

@Builder
@Getter
public class ChatGptPromptResponseDto {
private ChatGptPrompt prompt;
private ChatGptCreationResultDto result;
private Map<String, String> result;

public static ChatGptPromptResponseDto of(Prompt prompt, ChatGptPrompt chatGptPrompt) {
Map<String, String> result = new LinkedHashMap<>();

if (prompt.getName() != null) {
result.put("네이밍", prompt.getName());
}
if (prompt.getReason() != null) {
result.put("네이밍 이유", prompt.getReason());
}
if (prompt.getSlogan() != null) {
result.put("슬로건", prompt.getSlogan());
}
if (prompt.getVision() != null) {
result.put("비전 미션", prompt.getVision());
}
if (prompt.getEssence() != null) {
result.put("브랜드 에센스", prompt.getEssence());
}
if (prompt.getKeyword() != null) {
result.put("키워드", prompt.getKeyword());
}
if (prompt.getManifesto() != null) {
result.put("메니페스토", prompt.getManifesto());
}

return ChatGptPromptResponseDto.builder()
.prompt(chatGptPrompt)
.result(result)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,8 @@ public ChatGptPromptResponseDto getPrompt(Long id) {
Prompt prompt = promptOptional.get();

ChatGptPrompt chatGptPrompt = ChatGptPrompt.from(prompt);
ChatGptCreationResultDto chatGptCreationResultDto = ChatGptCreationResultDto.from(prompt);

return ChatGptPromptResponseDto.builder()
.prompt(chatGptPrompt)
.result(chatGptCreationResultDto)
.build();
return ChatGptPromptResponseDto.of(prompt, chatGptPrompt);
} else {
throw new NotFoundException("해당 프롬프트를 찾을 수가 없습니다 : id = " + id);
}
Expand Down

0 comments on commit 5c8ae65

Please sign in to comment.