Implement moderated Q&A board: questions only display after being answered

This commit is contained in:
Shanmuga Krishnan S M
2026-07-27 08:39:58 +05:30
parent e993cc4ec9
commit 42933f88cc
3 changed files with 41 additions and 29 deletions

View File

@@ -28,7 +28,7 @@ public class CommunityQuestionController {
@GetMapping
public List<CommunityQuestion> getAllQuestions() {
return questionRepository.findAll();
return questionRepository.findByIsAnsweredTrue();
}
@PostMapping

View File

@@ -3,7 +3,9 @@ package com.rit.portal.repository;
import com.rit.portal.entity.CommunityQuestion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CommunityQuestionRepository extends JpaRepository<CommunityQuestion, Integer> {
List<CommunityQuestion> findByIsAnsweredTrue();
}