mirror of https://github.com/halo-dev/halo
Complete sheet comment creation api
parent
d7aebebf18
commit
8dc22c20e5
|
@ -0,0 +1,33 @@
|
||||||
|
package run.halo.app.controller.admin.api;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import run.halo.app.model.dto.BaseCommentDTO;
|
||||||
|
import run.halo.app.model.entity.SheetComment;
|
||||||
|
import run.halo.app.model.params.SheetCommentParam;
|
||||||
|
import run.halo.app.service.SheetCommentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-25
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/admin/sheets/comments")
|
||||||
|
public class SheetCommentController {
|
||||||
|
|
||||||
|
private final SheetCommentService sheetCommentService;
|
||||||
|
|
||||||
|
public SheetCommentController(SheetCommentService sheetCommentService) {
|
||||||
|
this.sheetCommentService = sheetCommentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation("Creates a comment (new or reply)")
|
||||||
|
public BaseCommentDTO createBy(@RequestBody SheetCommentParam commentParam) {
|
||||||
|
SheetComment createdComment = sheetCommentService.createBy(commentParam);
|
||||||
|
return sheetCommentService.convertTo(createdComment);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package run.halo.app.model.params;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import run.halo.app.model.entity.SheetComment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sheet comment param.
|
||||||
|
*
|
||||||
|
* @author johnniang
|
||||||
|
* @date 19-4-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SheetCommentParam extends BaseCommentParam<SheetComment> {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue