Skip to content

Commit

Permalink
Fix: QuestionPaper를 ID 기준 역순으로 조회하도록 변경
Browse files Browse the repository at this point in the history
[#48]
  • Loading branch information
MuseopKim committed Jun 28, 2021
1 parent b978d7b commit 11d941e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/careerzip/controller/AdminController.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public ApiResponse<AdminArchiveResponse> findArchive(@PathVariable Long archiveI
return ApiResponse.success(archive);
}

@GetMapping("/questionpapers")
public ApiResponse<List<AdminQuestionPaperDetail>> findAllQuestionPapers() {
List<AdminQuestionPaperDetail> questionPapers = adminService.findAllQuestionPapers();
return ApiResponse.success(questionPapers);
}

@GetMapping("/news-letter/campaigns")
public ApiResponse<CampaignsResponse> findAllCampaigns() {
CampaignsResponse campaigns = newsLetterService.findAllCampaigns();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import com.careerzip.domain.questionpaper.entity.QuestionPaper;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface QuestionPaperRepository extends JpaRepository<QuestionPaper, Long>, QuestionPaperRepositoryCustom {

Optional<QuestionPaper> findLatest();

List<QuestionPaper> findAllByOrderByIdDesc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -57,7 +56,7 @@ public AdminArchiveResponse findArchiveBy(Long archiveId) {
}

public List<AdminQuestionPaperDetail> findAllQuestionPapers() {
List<QuestionPaper> questionPapers = questionPaperRepository.findAll();
List<QuestionPaper> questionPapers = questionPaperRepository.findAllByOrderByIdDesc();
return AdminQuestionPaperDetail.listOf(questionPapers);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/admin/news-letter/campaigns/reminders").permitAll()
.antMatchers("/admin/news-letter/campaigns/main/contacts").permitAll()
.antMatchers("/admin/news-letter/contacts/not-archived").permitAll()
.antMatchers("/admin/questionpapers").permitAll()
.antMatchers("/admin/**").hasRole(ADMIN.name())
.anyRequest().authenticated();

Expand Down

0 comments on commit 11d941e

Please sign in to comment.