From 5d4f0e3079a960bcd7abaa5892fb61eab95fe981 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Sat, 12 Sep 2020 13:11:09 +0400 Subject: [PATCH] fix project api description --- build.gradle | 2 -- .../controllers/TimeSeriesController.java | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 577b138..8a3c78a 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,6 @@ plugins { id 'org.springframework.boot' version '2.3.3.RELEASE' } -//mainClassName = 'ru.ulstu.TimeSeriesApplication' - jar { archivesBaseName='time-series-smoothing' } diff --git a/src/main/java/ru/ulstu/controllers/TimeSeriesController.java b/src/main/java/ru/ulstu/controllers/TimeSeriesController.java index de58bb8..50a70d5 100644 --- a/src/main/java/ru/ulstu/controllers/TimeSeriesController.java +++ b/src/main/java/ru/ulstu/controllers/TimeSeriesController.java @@ -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 isAlive() { return new ResponseEntity<>(true, HttpStatus.OK); } - @RequestMapping(value = "ts.get_random", method = RequestMethod.GET) + @GetMapping("getRandom") + @ApiOperation("Получить временной ряд рандомной длины") public ResponseEntity 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 getForecastTimeSeries(@RequestBody TimeSeries timeSeries) { return new ResponseEntity<>(timeSeriesService.getForecast(timeSeries), HttpStatus.OK); }