Skip to content

Commit

Permalink
update ChatController
Browse files Browse the repository at this point in the history
  • Loading branch information
Hot-dong committed Jul 6, 2023
1 parent b6a969a commit dd42b7b
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.khpt.projectkim.dto.ExtractListFromUserDto;
import com.khpt.projectkim.entity.User;
import com.khpt.projectkim.service.ChatService;
import com.khpt.projectkim.service.QuestionService;
import com.khpt.projectkim.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
Expand All @@ -24,6 +25,8 @@ public class ChatController {

private final UserService userService;

private final QuestionService questionService;

// TODO check if prev data exist
// TODO add design if no prev data is provided
// TODO add examples. Add html code, with js
Expand Down Expand Up @@ -75,6 +78,10 @@ public String chat(HttpSession session, Model model) {
model.addAttribute("results", filledDto.getResults());
model.addAttribute("chats", filledDto.getChats());

if (filledDto.getChats().size() == 0) {
model.addAttribute("questions", questionService.getRandomQuestions());
}

return "chat";
}
}

0 comments on commit dd42b7b

Please sign in to comment.