Changeset 62bba0c for src/main/java/com/example/skychasemk/controller/TopMonthlyReportController.java
- Timestamp:
- 02/23/25 20:37:56 (3 months ago)
- Branches:
- master
- Children:
- fda671c
- Parents:
- de83113
- git-author:
- ste08 <sjovanoska@…> (02/23/25 20:37:23)
- git-committer:
- ste08 <sjovanoska@…> (02/23/25 20:37:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/skychasemk/controller/TopMonthlyReportController.java
rde83113 r62bba0c 2 2 3 3 import com.example.skychasemk.model.TopMonthlyReport; 4 import com.example.skychasemk. services.TopMonthlyReportService;4 import com.example.skychasemk.repository.TopMonthlyReportRepository; 5 5 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.ui.Model; 6 7 import org.springframework.web.bind.annotation.*; 7 8 8 import java.time.LocalDate;9 9 import java.util.List; 10 10 11 11 @RestController 12 @RequestMapping("/api/reports") 13 @CrossOrigin("*") 12 @RequestMapping("/api/views") 14 13 public class TopMonthlyReportController { 15 14 @Autowired 16 private TopMonthlyReportService service; 15 private TopMonthlyReportRepository repository; 16 17 17 18 @GetMapping 18 public String getReportsPage() {19 return "TopMonthlyReport";19 public List<TopMonthlyReport> getAllReports() { 20 return repository.findAll(); 20 21 } 21 22 22 @GetMapping("/top-monthly")23 public List<TopMonthlyReport> getAllReports() {24 return service.getAllReports();25 }26 27 @GetMapping("/top-monthly/{month}")28 public List<TopMonthlyReport> getReportsByMonth(@PathVariable String month) {29 return service.getReportsByMonth(LocalDate.parse(month));30 }31 23 }
Note:
See TracChangeset
for help on using the changeset viewer.