Freshers-qa

This commit is contained in:
Devesh S
2026-07-23 22:19:20 +05:30
9 changed files with 385 additions and 622 deletions

View File

@@ -31,19 +31,6 @@ public class CommunityQuestionController {
return questionRepository.findAll();
}
@GetMapping("/paged")
public org.springframework.data.domain.Page<CommunityQuestion> getPagedQuestions(
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "5") int size) {
return questionRepository.findAll(
org.springframework.data.domain.PageRequest.of(
page,
size,
org.springframework.data.domain.Sort.by("createdAt").descending()
)
);
}
@PostMapping
public CommunityQuestion createQuestion(@RequestBody CommunityQuestion question) {
if (question.getUpvotes() == null) question.setUpvotes(0);

View File

@@ -1,5 +1,5 @@
# ─── DATABASE CONNECTION CONFIGURATION ───
spring.datasource.url=jdbc:postgresql://localhost:5432/rit_freshers_hub?sslmode=disable
spring.datasource.url=jdbc:postgresql://localhost:5433/rit_freshers_hub?sslmode=disable
spring.datasource.username=postgres
spring.datasource.password=${DB_PASSWORD:Anbukathir@#$2006}