diff --git a/src/main/java/com/finfellows/domain/chatgpt/application/ChatGptService.java b/src/main/java/com/finfellows/domain/chatgpt/application/ChatGptService.java index 0fa7e4f..da6ba38 100644 --- a/src/main/java/com/finfellows/domain/chatgpt/application/ChatGptService.java +++ b/src/main/java/com/finfellows/domain/chatgpt/application/ChatGptService.java @@ -32,5 +32,6 @@ public String getChatResponse(String prompt) { return "request error"; } } + } diff --git a/src/main/java/com/finfellows/domain/comment/application/CommentService.java b/src/main/java/com/finfellows/domain/comment/application/CommentService.java index 6bf2e86..2b741d8 100644 --- a/src/main/java/com/finfellows/domain/comment/application/CommentService.java +++ b/src/main/java/com/finfellows/domain/comment/application/CommentService.java @@ -40,6 +40,7 @@ public class CommentService { @Autowired private RestTemplate restTemplate; + @Value("${chatgpt.api-key}") private String apiKey; private final ObjectMapper objectMapper = new ObjectMapper() @@ -56,7 +57,6 @@ public HttpEntity buildHttpEntity(ChatgptRequest chatGptRequest) // gpt 단답 public ChatgptResponse getResponse(HttpEntity chatGptRequestHttpEntity) { - SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setConnectTimeout(60000); //답변이 길어질 경우 TimeOut Error가 발생하니 1분정도 설정해줍니다. @@ -91,7 +91,6 @@ public ChatgptResponse askQuestion(ChatgptQuestionRequest questionRequest) { ); } - public String getChatResponse(String question){ String responseFromGPT=chatGptService.getChatResponse(question); return responseFromGPT; diff --git a/src/main/java/com/finfellows/domain/educontent/domain/EduContent.java b/src/main/java/com/finfellows/domain/educontent/domain/EduContent.java index 420223b..37dc0f1 100644 --- a/src/main/java/com/finfellows/domain/educontent/domain/EduContent.java +++ b/src/main/java/com/finfellows/domain/educontent/domain/EduContent.java @@ -1,6 +1,7 @@ package com.finfellows.domain.educontent.domain; import com.finfellows.domain.common.BaseEntity; +import com.finfellows.domain.post.domain.ContentType; import com.finfellows.domain.post.domain.Post; import jakarta.persistence.*; import lombok.AccessLevel; @@ -25,6 +26,10 @@ public class EduContent extends BaseEntity { @JoinColumn(name="post_id") private Post post; + @Enumerated(EnumType.STRING) + @Column(name="contentType") + private ContentType contentType; + @Column(name="title") private String title; @@ -37,6 +42,12 @@ public EduContent(Post post, String title, String content){ this.post=post; this.title=title; this.content=content; + this.contentType = ContentType.EDU_CONTENT; + } + + public void updateContent(String title, String content) { + this.title = title; + this.content = content; } public void updateContent(String title, String content) { diff --git a/src/main/java/com/finfellows/domain/educontent/dto/request/EduContentRequest.java b/src/main/java/com/finfellows/domain/educontent/dto/request/EduContentRequest.java index e09677a..e8c2b3c 100644 --- a/src/main/java/com/finfellows/domain/educontent/dto/request/EduContentRequest.java +++ b/src/main/java/com/finfellows/domain/educontent/dto/request/EduContentRequest.java @@ -5,7 +5,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; - import java.time.LocalDateTime; @Getter diff --git a/src/main/java/com/finfellows/domain/educontent/dto/response/EduContentResponse.java b/src/main/java/com/finfellows/domain/educontent/dto/response/EduContentResponse.java index 1422270..a2231c6 100644 --- a/src/main/java/com/finfellows/domain/educontent/dto/response/EduContentResponse.java +++ b/src/main/java/com/finfellows/domain/educontent/dto/response/EduContentResponse.java @@ -7,7 +7,6 @@ import java.time.LocalDateTime; - @Getter @Builder @AllArgsConstructor diff --git a/src/main/java/com/finfellows/domain/newscontent/domain/NewsContent.java b/src/main/java/com/finfellows/domain/newscontent/domain/NewsContent.java index 5d6006c..3a83299 100644 --- a/src/main/java/com/finfellows/domain/newscontent/domain/NewsContent.java +++ b/src/main/java/com/finfellows/domain/newscontent/domain/NewsContent.java @@ -1,6 +1,9 @@ package com.finfellows.domain.newscontent.domain; import com.finfellows.domain.common.BaseEntity; + +import com.finfellows.domain.post.domain.ContentType; + import com.finfellows.domain.post.domain.Post; import jakarta.persistence.*; import lombok.Builder; @@ -29,11 +32,17 @@ public class NewsContent extends BaseEntity { @Column(name="content") private String content; + @Enumerated(EnumType.STRING) + @Column(name="contentType") + private ContentType contentType; + @Builder public NewsContent(Post post, String title, String content){ this.post=post; this.title=title; this.content=content; + this.contentType = ContentType.NEWS_CONTENT; + } public void updateContent(String title, String content) { diff --git a/src/main/java/com/finfellows/domain/post/domain/Content.java b/src/main/java/com/finfellows/domain/post/domain/Content.java index c5f3db5..a865285 100644 --- a/src/main/java/com/finfellows/domain/post/domain/Content.java +++ b/src/main/java/com/finfellows/domain/post/domain/Content.java @@ -32,12 +32,18 @@ public class Content { @Column(name="content") private String content; + @Enumerated(EnumType.STRING) + @Column(name="contentType") + private ContentType contentType; + @Builder public Content(Post post_id, String title, String content){ this.post_id=post_id; this.title=title; this.content=content; + this.contentType = ContentType.CONTENT; + } public void updateContent(String title, String content) { diff --git a/src/main/java/com/finfellows/domain/post/domain/ContentType.java b/src/main/java/com/finfellows/domain/post/domain/ContentType.java new file mode 100644 index 0000000..a0f2316 --- /dev/null +++ b/src/main/java/com/finfellows/domain/post/domain/ContentType.java @@ -0,0 +1,7 @@ +package com.finfellows.domain.post.domain; + +public enum ContentType { + EDU_CONTENT, + NEWS_CONTENT, + CONTENT +} diff --git a/src/main/java/com/finfellows/domain/post/domain/Post.java b/src/main/java/com/finfellows/domain/post/domain/Post.java index 5231c18..f661ccf 100644 --- a/src/main/java/com/finfellows/domain/post/domain/Post.java +++ b/src/main/java/com/finfellows/domain/post/domain/Post.java @@ -26,9 +26,14 @@ public class Post extends BaseEntity { @JoinColumn(name="writer_id") private User writer; + @Enumerated(EnumType.STRING) + @Column(name="contentType") + private ContentType contentType; + @Builder - public Post(User writer){ + public Post(User writer, ContentType contentType){ this.writer=writer; + this.contentType=contentType; } }