get requests
This commit is contained in:
@@ -3,6 +3,7 @@ package ru.ip.example.controller;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -12,6 +13,8 @@ import ru.ip.example.domain.AddSeriesDto;
|
||||
import ru.ip.example.domain.SeazonDto;
|
||||
import ru.ip.example.service.SeazonService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "SeazonsAPI", description = "Контроллер для управления сезонами")
|
||||
@@ -19,6 +22,16 @@ public class SeazonController {
|
||||
|
||||
private final SeazonService seazonService;
|
||||
|
||||
@GetMapping("/seazons")
|
||||
public List<SeazonDto> getSeazons() {
|
||||
return seazonService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/seazons/{id}")
|
||||
public SeazonDto getSeazon(@PathVariable("id") Integer id) {
|
||||
return seazonService.findById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/seazons")
|
||||
public SeazonDto save(@RequestBody SeazonDto dto) {
|
||||
return seazonService.save(dto);
|
||||
|
||||
@@ -3,14 +3,18 @@ package ru.ip.example.controller;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.ip.example.domain.SeazonDto;
|
||||
import ru.ip.example.domain.SeriesDto;
|
||||
import ru.ip.example.service.SeriesService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "SeriesAPI", description = "API для работы с сериями")
|
||||
@@ -18,6 +22,16 @@ public class SeriesController {
|
||||
|
||||
private final SeriesService seriesService;
|
||||
|
||||
@GetMapping("/series")
|
||||
public List<SeriesDto> getSeries() {
|
||||
return seriesService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/series/{id}")
|
||||
public SeriesDto getSeries(@PathVariable("id") Integer id) {
|
||||
return seriesService.findById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/series")
|
||||
public SeriesDto save(@RequestBody SeriesDto dto) {
|
||||
return seriesService.save(dto);
|
||||
|
||||
Reference in New Issue
Block a user