fix project api description

This commit is contained in:
Anton Romanov 2020-09-12 13:11:09 +04:00
parent 97938452b7
commit 5d4f0e3079
2 changed files with 13 additions and 8 deletions

View File

@ -4,8 +4,6 @@ plugins {
id 'org.springframework.boot' version '2.3.3.RELEASE'
}
//mainClassName = 'ru.ulstu.TimeSeriesApplication'
jar {
archivesBaseName='time-series-smoothing'
}

View File

@ -1,9 +1,14 @@
package ru.ulstu.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ru.ulstu.configurations.ApiConfiguration;
import ru.ulstu.models.TimeSeries;
import ru.ulstu.services.TimeSeriesService;
@ -14,22 +19,24 @@ public class TimeSeriesController {
private final TimeSeriesService timeSeriesService;
@Autowired
public TimeSeriesController(TimeSeriesService timeSeriesService) {
this.timeSeriesService = timeSeriesService;
}
@RequestMapping(value = "ts.is_alive", method = RequestMethod.GET)
@GetMapping("isAlive")
@ApiOperation("Проверка сервиса")
public ResponseEntity<Boolean> isAlive() {
return new ResponseEntity<>(true, HttpStatus.OK);
}
@RequestMapping(value = "ts.get_random", method = RequestMethod.GET)
@GetMapping("getRandom")
@ApiOperation("Получить временной ряд рандомной длины")
public ResponseEntity<TimeSeries> getRandomTimeSeries(@RequestParam("length") int length) {
return new ResponseEntity<>(timeSeriesService.getRandomTimeSeries(length), HttpStatus.OK);
}
@RequestMapping(value = "ts.get_forecast", method = RequestMethod.POST)
@PostMapping("getForecast")
@ApiOperation("Получить прогноз временного ряда")
public ResponseEntity<TimeSeries> getForecastTimeSeries(@RequestBody TimeSeries timeSeries) {
return new ResponseEntity<>(timeSeriesService.getForecast(timeSeries), HttpStatus.OK);
}