Skip to content

Commit

Permalink
feat: add api for delete photos in batch
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <i@ryanc.cc>
  • Loading branch information
ruibaby committed Feb 25, 2022
1 parent 631b214 commit 5959fdf
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ public void deletePermanently(@PathVariable("photoId") Integer photoId) {
photoService.removeById(photoId);
}

@DeleteMapping("/batch")
@ApiOperation("Deletes photos permanently in batch by id array")
public List<PhotoDTO> deletePermanentlyInBatch(@RequestBody List<Integer> ids) {
return ids.stream().map(photoService::removeById)
.map(photo -> (PhotoDTO) new PhotoDTO().convertFrom(photo))
.collect(Collectors.toList());
}

@PostMapping
@ApiOperation("Creates a photo")
public PhotoDTO createBy(@Valid @RequestBody PhotoParam photoParam) {
Expand Down

0 comments on commit 5959fdf

Please sign in to comment.