stable POC version 1 - chat and topics
This commit is contained in:
@@ -10,23 +10,23 @@ import java.util.NoSuchElementException;
|
||||
@RequestMapping("/api/v1/topics")
|
||||
public class TopicController {
|
||||
|
||||
private final TopicConfigLoader topicConfigLoader;
|
||||
private final TopicRepository topicRepository;
|
||||
private final TopicSummaryService topicSummaryService;
|
||||
|
||||
public TopicController(TopicConfigLoader topicConfigLoader,
|
||||
public TopicController(TopicRepository topicRepository,
|
||||
TopicSummaryService topicSummaryService) {
|
||||
this.topicConfigLoader = topicConfigLoader;
|
||||
this.topicRepository = topicRepository;
|
||||
this.topicSummaryService = topicSummaryService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<List<Topic>> list() {
|
||||
return ResponseEntity.ok(topicConfigLoader.getAll());
|
||||
return ResponseEntity.ok(topicRepository.findAll());
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/summary")
|
||||
public ResponseEntity<TopicSummaryResponse> generateSummary(@PathVariable String id) {
|
||||
Topic topic = topicConfigLoader.findById(id)
|
||||
Topic topic = topicRepository.findById(id)
|
||||
.orElseThrow(() -> new NoSuchElementException("Topic not found."));
|
||||
|
||||
TopicSummaryResponse response = topicSummaryService.generateSummary(topic);
|
||||
|
||||
Reference in New Issue
Block a user