Projekt

Obecné

Profil

Stáhnout (1.07 KB) Statistiky
| Větev: | Tag: | Revize:
1 c1e7e376 Jakub Šmíd
package cz.zcu.kiv.backendapi.titlepage;
2
3 e91fef9c Jakub Smid
import io.swagger.v3.oas.annotations.Operation;
4 c1e7e376 Jakub Šmíd
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 title page
11
 */
12
@RequiredArgsConstructor
13
@RestController
14 c0dc6652 Jakub Smid
@RequestMapping("/api/title-page")
15 c1e7e376 Jakub Šmíd
public class TitlePageController {
16
    /**
17
     * Title page service
18
     */
19
    private final ITitlePageService titlePageService;
20
21
    /**
22 b30f120b Jakub Smid
     * Returns title page
23 c1e7e376 Jakub Šmíd
     *
24 b30f120b Jakub Smid
     * @return title page
25 c1e7e376 Jakub Šmíd
     */
26
    @GetMapping("")
27 e91fef9c Jakub Smid
    @Operation(summary = "returns title page")
28 b30f120b Jakub Smid
    public ResponseEntity<TitlePage> getTitlePage() {
29
        return new ResponseEntity<>(titlePageService.getTitlePage(), HttpStatus.OK);
30 c1e7e376 Jakub Šmíd
    }
31
32
    /**
33 b30f120b Jakub Smid
     * Updates title page
34 c1e7e376 Jakub Šmíd
     *
35
     * @param titlePage title page
36
     */
37 b30f120b Jakub Smid
    @PostMapping("")
38 e91fef9c Jakub Smid
    @Operation(summary = "updates/creates title page")
39 b30f120b Jakub Smid
    public void updateTitlePage(@RequestBody TitlePage titlePage) {
40
        titlePageService.updateTitlePage(titlePage);
41 c1e7e376 Jakub Šmíd
    }
42
43
}