mirror of https://github.com/halo-dev/halo
refactor: comment status update api.
parent
4ec90d2d7f
commit
3ba40b3e1c
|
@ -8,7 +8,6 @@ import org.springframework.data.domain.Sort;
|
|||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import run.halo.app.model.BaseCommentUpdateStatusParam;
|
||||
import run.halo.app.model.dto.BaseCommentDTO;
|
||||
import run.halo.app.model.entity.PostComment;
|
||||
import run.halo.app.model.enums.CommentStatus;
|
||||
|
@ -97,10 +96,11 @@ public class PostCommentController {
|
|||
return postCommentService.convertTo(updatedPostComment);
|
||||
}
|
||||
|
||||
@PutMapping("status")
|
||||
@PutMapping("status/{status}")
|
||||
@ApiOperation("Updates post comment status in batch")
|
||||
public List<BaseCommentDTO> updateStatusInBatch(@RequestBody BaseCommentUpdateStatusParam param) {
|
||||
List<PostComment> comments = postCommentService.updateStatusByIds(param.getIds(), param.getStatus());
|
||||
public List<BaseCommentDTO> updateStatusInBatch(@PathVariable(name = "status") CommentStatus status,
|
||||
@RequestBody List<Long> ids) {
|
||||
List<PostComment> comments = postCommentService.updateStatusByIds(ids, status);
|
||||
return postCommentService.convertTo(comments);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.springframework.data.domain.Sort;
|
|||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import run.halo.app.model.BaseCommentUpdateStatusParam;
|
||||
import run.halo.app.model.dto.BaseCommentDTO;
|
||||
import run.halo.app.model.entity.SheetComment;
|
||||
import run.halo.app.model.enums.CommentStatus;
|
||||
|
@ -92,10 +91,11 @@ public class SheetCommentController {
|
|||
return sheetCommentService.convertTo(updatedSheetComment);
|
||||
}
|
||||
|
||||
@PutMapping("status")
|
||||
@PutMapping("status/{status}")
|
||||
@ApiOperation("Updates sheet comment status in batch")
|
||||
public List<BaseCommentDTO> updateStatusInBatch(@RequestBody BaseCommentUpdateStatusParam param) {
|
||||
List<SheetComment> comments = sheetCommentService.updateStatusByIds(param.getIds(), param.getStatus());
|
||||
public List<BaseCommentDTO> updateStatusInBatch(@PathVariable(name = "status") CommentStatus status,
|
||||
@RequestBody List<Long> ids) {
|
||||
List<SheetComment> comments = sheetCommentService.updateStatusByIds(ids, status);
|
||||
return sheetCommentService.convertTo(comments);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package run.halo.app.model;
|
||||
|
||||
import lombok.Data;
|
||||
import run.halo.app.model.enums.CommentStatus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Base comment update status param.
|
||||
*
|
||||
* @author ryanwang
|
||||
* @date 2019-12-12
|
||||
*/
|
||||
@Data
|
||||
public class BaseCommentUpdateStatusParam {
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
private CommentStatus status;
|
||||
}
|
Loading…
Reference in New Issue