Projekt

Obecné

Profil

Stáhnout (1.26 KB) Statistiky
| Větev: | Tag: | Revize:
1
package cz.zcu.kiv.backendapi.external;
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
import java.util.List;
10

    
11
/**
12
 * Controller for external catalog
13
 */
14
@RestController
15
@RequiredArgsConstructor
16
@RequestMapping("/external-catalog-items")
17
public class ExternalCatalogController {
18

    
19
    /**
20
     * External catalog service
21
     */
22
    private final IExternalCatalogItemService externalCatalogService;
23

    
24
    @PostMapping("")
25
    @Operation(summary = "updates external catalog")
26
    public void updateCatalog() {
27
        externalCatalogService.updateCatalog();
28
    }
29

    
30
    /**
31
     * Returns external catalog items satisfying given filter
32
     *
33
     * @param name   name
34
     * @param source source
35
     * @return list of external catalog items satisfying given filter
36
     */
37
    @GetMapping("")
38
    @Operation(summary = "returns external catalog items based on filter")
39
    public ResponseEntity<List<ExternalCatalogItem>> getCatalog(@RequestParam String name, @RequestParam ExternalSource source) {
40
        return new ResponseEntity<>(externalCatalogService.getCatalog(name, source), HttpStatus.OK);
41
    }
42
}
(1-1/7)