Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0598e57d

Přidáno uživatelem Jakub Šmíd před asi 2 roky(ů)

Added batch endpoint for saving multiple catalog items, POST and PUT endpoint for catalog items merged

re #9753

Zobrazit rozdíly:

backend/src/main/java/cz/zcu/kiv/backendapi/catalog/CatalogController.java
23 23
    private final ICatalogItemService catalogService;
24 24

  
25 25
    /**
26
     * Saves new catalog item
26
     * Creates new or updates catalog item
27 27
     *
28 28
     * @param catalogItemDto catalog item DTO
29 29
     */
30 30
    @PostMapping("")
31
    @Operation(summary = "creates new catalog item")
32
    public void addCatalogItem(@RequestBody CatalogItemDto catalogItemDto) {
31
    @Operation(summary = "creates new or updates catalog item")
32
    public void saveCatalogItem(@RequestBody CatalogItemDto catalogItemDto) {
33 33
        catalogService.saveCatalogItem(catalogItemDto);
34 34
    }
35 35

  
36
    /**
37
     * Saves list of catalog items
38
     *
39
     * @param catalogItemDtoList list of catalog items DTO
40
     */
41
    @PostMapping("/batch")
42
    @Operation(summary = "saves list of catalog items")
43
    public void saveCatalogItems(@RequestBody List<CatalogItemDto> catalogItemDtoList) {
44
        catalogService.saveCatalogItems(catalogItemDtoList);
45
    }
46

  
36 47
    /**
37 48
     * Returns catalog items satisfying given filter
38 49
     *
......
47 58
        return new ResponseEntity<>(catalogService.getCatalog(name, country, type, writtenForm), HttpStatus.OK);
48 59
    }
49 60

  
50
    /**
51
     * Updates catalog item with given ID
52
     *
53
     * @param id             ID
54
     * @param catalogItemDto catalog item DTO
55
     */
56
    @PutMapping("/{id}")
57
    @Operation(summary = "updates catalog item with given ID")
58
    public void updateCatalogItem(@PathVariable UUID id, @RequestBody CatalogItemDto catalogItemDto) {
59
        catalogService.updateCatalogItem(id, catalogItemDto);
60
    }
61 61

  
62 62
    /**
63 63
     * Deletes catalog item with given ID

Také k dispozici: Unified diff