Projekt

Obecné

Profil

Stáhnout (1.01 KB) Statistiky
| Větev: | Tag: | Revize:
1
package cz.zcu.kiv.backendapi.sources;
2

    
3
import io.swagger.v3.oas.annotations.Operation;
4
import lombok.RequiredArgsConstructor;
5
import org.springframework.http.HttpStatus;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.bind.annotation.*;
8

    
9
/**
10
 * Controller for sources
11
 */
12
@RequiredArgsConstructor
13
@RestController
14
@RequestMapping("/sources")
15
public class SourcesController {
16
    /**
17
     * Sources service
18
     */
19
    private final ISourcesService sourcesService;
20

    
21
    /**
22
     * Returns sources
23
     *
24
     * @return sources
25
     */
26
    @GetMapping("")
27
    @Operation(summary = "returns sources")
28
    public ResponseEntity<Sources> getTitlePage() {
29
        return new ResponseEntity<>(sourcesService.getSources(), HttpStatus.OK);
30
    }
31

    
32
    /**
33
     * Updates sources
34
     *
35
     * @param sources sources
36
     */
37
    @PostMapping("")
38
    @Operation(summary = "updates/creates sources")
39
    public void updateTitlePage(@RequestBody Sources sources) {
40
        sourcesService.updateSources(sources);
41
    }
42

    
43
}
(3-3/5)