Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Stravinsken committed Aug 26, 2024
2 parents 3c5b3d7 + 635c115 commit 568a084
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -14,7 +15,7 @@ public class AiController {
private final OpenAiChatModel openAiChatModel;

@GetMapping("/chat")
public String chat(@RequestParam String message) {
public String chat(@RequestBody String message) {
return openAiChatModel.call(String.valueOf(message));
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@Tag(name = "투두", description = "ToDo")
@RestController
@RequestMapping("/posts")
@RequestMapping("/todos")
@RequiredArgsConstructor
public class TodoController {
private final TodoService todoService;
Expand All @@ -46,7 +46,7 @@ public void deleteTodo(@PathVariable Long todoId) {
todoService.deleteTodo(todoId);
}

@PostMapping("/{todoId}")
@PatchMapping("/{todoId}/check")
public void checkTodo(@PathVariable Long todoId) {
todoService.todoCheck(todoId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import com.example.crescendoserver.domain.todo.domain.Todo;
import com.example.crescendoserver.domain.user.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TodoRepository extends JpaRepository<Todo, Long> {
List<Todo> findAllByAuthorOrderByIdDesc(User author);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Service
@RequiredArgsConstructor
public class TodoServiceImpl implements TodoService {
private TodoRepository todoRepository;
private final TodoRepository todoRepository;
private final AuthService authService;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.crescendoserver.domain.user.domain;

public enum UserRole {
USER,
ADMIN
USER
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.requestMatchers(HttpMethod.GET, "/ws/chat").permitAll()
.requestMatchers(HttpMethod.POST, "/chat").permitAll()
.requestMatchers(HttpMethod.GET, "/chat").permitAll()
.requestMatchers(HttpMethod.GET, "/todos/{todoId}").permitAll()
.requestMatchers(HttpMethod.GET, "/todos").permitAll()
.requestMatchers(HttpMethod.POST, "/todos").permitAll()
.requestMatchers(HttpMethod.PATCH, "/todos/{todoId}/check").permitAll()
.requestMatchers(HttpMethod.PATCH, "/todos/{todoId}").permitAll()
.requestMatchers(HttpMethod.DELETE, "/todos/{todoId}").permitAll()
)

.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
Expand Down
14 changes: 6 additions & 8 deletions crescendo-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ spring:
# dialect: org.hibernate.dialect.PostgreSQLDialect
show-sql: true
hibernate:
ddl-auto: create

ai:
openai:
api-key: ${CHATGPT_API_KEY}
chat:
options:
model: gpt-3.5-turbo
ddl-auto: update

ai:
openai:
api-key: ${CHATGPT_API_KEY}



redis:
Expand Down

0 comments on commit 568a084

Please sign in to comment.