Merge pull request #1680 from ruibaby/feat/api-for-delete-photo-in-batch

feat: add api for delete photos in batch
pull/1682/head
guqing 2022-02-25 16:08:49 +08:00 committed by GitHub
commit 89c0cb5fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {