Skip to content

Commit

Permalink
feat : create dtos
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungGyo-00 committed Feb 1, 2024
1 parent 1b2f375 commit c70d7fd
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
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 ChatGptCreationResultDto {
private Map<String, String> result;

public static ChatGptCreationResultDto from(Prompt prompt) {
Map<String, String> result = new LinkedHashMap<>();

if (prompt.getName() != null) {
result.put("name", prompt.getName());
}
if (prompt.getReason() != null) {
result.put("reason", prompt.getReason());
}
if (prompt.getSlogan() != null) {
result.put("slogan", prompt.getSlogan());
}
if (prompt.getVision() != null) {
result.put("vision", prompt.getVision());
}
if (prompt.getEssence() != null) {
result.put("essence", prompt.getEssence());
}
if (prompt.getKeyword() != null) {
result.put("keyword", prompt.getKeyword());
}
if (prompt.getManifesto() != null) {
result.put("manifesto", prompt.getManifesto());
}

return ChatGptCreationResultDto.builder()
.result(result)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.example.reddiserver.dto.chatgpt.response;

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

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Builder
@Getter
public class ChatGptResultResponseDto {
private Long id;
private String name;
private List<String> elements;

public static ChatGptResultResponseDto from(Prompt prompt) {
List<String> elements = new ArrayList<>();

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

return ChatGptResultResponseDto.builder()
.id(prompt.getId())
.name(prompt.getName())
.elements(elements)
.build();
}
}

0 comments on commit c70d7fd

Please sign in to comment.