feat: add api for delete photos in batch

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/1680/head
Ryan Wang 2022-02-25 15:55:11 +08:00
parent 631b2149d3
commit 5959fdfa2d
1 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,14 @@ public class PhotoController {
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) {