Skip to content

Commit

Permalink
Merge pull request #1680 from ruibaby/feat/api-for-delete-photo-in-batch
Browse files Browse the repository at this point in the history
feat: add api for delete photos in batch
  • Loading branch information
guqing authored Feb 25, 2022
2 parents 631b214 + 5959fdf commit 89c0cb5
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 89c0cb5

Please sign in to comment.