Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all CrossOrigin annotations from InterestController #17

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,69 +38,58 @@ public class InterestController {
@Autowired
private ProjectsService projectsService;

@CrossOrigin(origins = "*")
@GetMapping(value = "/cumulativeInterest")
Collection<CumulativeInterest> getCumulativeInterestPerCommit(@RequestParam(required = true) String url, @RequestParam(required = false) String sha) {
if (Objects.isNull(sha))
return metricsService.findCumulativeInterestPerCommit(url);
return metricsService.findCumulativeInterestByCommit(url, sha);
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/interestPerCommitFile")
Collection<InterestPerCommitFile> getInterestPerCommitFile(@RequestParam(required = true) String url, @RequestParam(required = true) String sha, @RequestParam(required = true) String filePath) {
return metricsService.findInterestByCommitFile(url, sha, filePath);
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/interestChange")
Collection<InterestChange> getLastCommitInterestChange(@RequestParam(required = true) String url, @RequestParam(required = true) String sha) {
return metricsService.findInterestChangeByCommit(url, sha);
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/fileInterestChange")
FileInterestChange getFileInterestChange(@RequestParam(required = true) String url, @RequestParam(required = true) String sha, @RequestParam(required = true) String filePath) {
return metricsService.findInterestChangeByCommitAndFile(url, sha, filePath);
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/normalizedInterest")
Collection<NormalizedInterest> getNormalizedInterest(@RequestParam(required = true) String url, @RequestParam(required = false) String sha) {
return (Objects.isNull(sha)) ? metricsService.findNormalizedInterest(url) : metricsService.findNormalizedInterestByCommit(url, sha);
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/highInterestFiles")
Collection<HighInterestFile> getHighInterestFiles(@RequestParam(required = true) String url, @RequestParam(required = true) String sha, @RequestParam(required = false) Integer limit) {
return Objects.isNull(limit) ? metricsService.findHighInterestFiles(null, url, sha).getContent() : metricsService.findHighInterestFiles(PageRequest.of(0, limit), url, sha).getContent();
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/reusabilityMetrics")
Collection<ProjectReusabilityMetrics> getReusabilityMetrics(@RequestParam(required = true) String url, @RequestParam(required = false) Integer limit) {
return Objects.isNull(limit) ? metricsService.findReusabilityMetrics(null, url).getContent() : metricsService.findReusabilityMetrics(PageRequest.of(0, limit), url).getContent();
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/reusabilityMetricsByCommit")
Collection<FileReusabilityMetrics> getReusabilityMetricsByCommit(@RequestParam(required = true) String url, @RequestParam(required = true) String sha, @RequestParam(required = false) Integer limit) {
return Objects.isNull(limit) ? metricsService.findReusabilityMetrics(null, url, sha).getContent() : metricsService.findReusabilityMetrics(PageRequest.of(0, limit), url, sha).getContent();
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/reusabilityMetricsByCommitAndFile")
Collection<FileReusabilityMetrics> getReusabilityMetricsByCommitAndFile(@RequestParam(required = true) String url, @RequestParam(required = true) String sha, @RequestParam(required = true) String filePath, @RequestParam(required = false) Integer limit) {
return Objects.isNull(limit) ? metricsService.findReusabilityMetrics(null, url, sha, filePath).getContent() : metricsService.findReusabilityMetrics(PageRequest.of(0, limit), url, sha, filePath).getContent();
}

@CrossOrigin(origins = "*")
@GetMapping(value = "/analyzedCommits")
Collection<AnalyzedCommit> getAnalyzedCommitIds(@RequestParam(required = true) String url, @RequestParam(required = false) Integer limit) {
return Objects.isNull(limit) ? metricsService.findAnalyzedCommits(null, url).getContent() : metricsService.findAnalyzedCommits(PageRequest.of(0, limit), url).getContent();
}

@CrossOrigin(origins = "*")
@PostMapping(path = "/startInterestAnalysis", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<Project> startInterestAnalysis(@RequestBody(required = true) AnalysisInfo info) throws IOException {
try {
Expand Down