package com.emergencyrepair.business.controller;
|
|
import com.emergencyrepair.business.dto.report.ReportContractorDto;
|
import com.emergencyrepair.business.dto.report.ReportMetricDto;
|
import com.emergencyrepair.business.dto.report.ReportOverviewDto;
|
import com.emergencyrepair.business.dto.report.ReportTeamDto;
|
import com.emergencyrepair.business.dto.report.ReportTrendDto;
|
import com.emergencyrepair.business.service.ReportService;
|
import com.emergencyrepair.common.Result;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
@RestController
|
@RequestMapping("/api/reports")
|
@RequiredArgsConstructor
|
public class ReportController {
|
private final ReportService reportService;
|
|
@GetMapping("/overview")
|
public Result<ReportOverviewDto> overview() {
|
return Result.ok(reportService.overview());
|
}
|
|
@GetMapping("/top-equipment")
|
public Result<List<ReportMetricDto>> topEquipment() {
|
return Result.ok(reportService.topEquipment());
|
}
|
|
@GetMapping("/by-team")
|
public Result<List<ReportTeamDto>> byTeam() {
|
return Result.ok(reportService.byTeam());
|
}
|
|
@GetMapping("/contractors")
|
public Result<List<ReportContractorDto>> contractors() {
|
return Result.ok(reportService.contractors());
|
}
|
|
@GetMapping("/yearly-trend")
|
public Result<List<ReportTrendDto>> yearlyTrend() {
|
return Result.ok(reportService.yearlyTrend());
|
}
|
}
|