Revize 7bf2464a
Přidáno uživatelem Jakub Šmíd před asi 2 roky(ů)
backend/src/main/java/cz/zcu/kiv/backendapi/external/ExternalCatalogController.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.backendapi.external; |
2 | 2 |
|
3 |
import io.swagger.v3.oas.annotations.Operation; |
|
3 | 4 |
import lombok.RequiredArgsConstructor; |
4 |
import org.springframework.web.bind.annotation.PostMapping; |
|
5 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
6 |
import org.springframework.web.bind.annotation.RestController; |
|
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; |
|
7 | 10 |
|
8 | 11 |
/** |
9 | 12 |
* Controller for external catalog |
... | ... | |
16 | 19 |
/** |
17 | 20 |
* External catalog service |
18 | 21 |
*/ |
19 |
private final IExternalCatalogService externalCatalogService; |
|
22 |
private final IExternalCatalogItemService externalCatalogService;
|
|
20 | 23 |
|
21 | 24 |
@PostMapping("") |
25 |
@Operation(summary = "updates external catalog") |
|
22 | 26 |
public void updateCatalog() { |
23 | 27 |
externalCatalogService.updateCatalog(); |
24 | 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 |
} |
|
25 | 42 |
} |
Také k dispozici: Unified diff
Added controller and some tests for external catalog
re #9624