提交 93eb1250 编写于 作者: RYAN0UP's avatar RYAN0UP

Fixed sheet update error.

上级 4a46132f
......@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.*;
import run.halo.app.model.dto.post.PostMinimalDTO;
import run.halo.app.model.dto.post.PostSimpleDTO;
import run.halo.app.model.entity.Post;
import run.halo.app.model.entity.Sheet;
import run.halo.app.model.enums.PostStatus;
import run.halo.app.model.params.PostParam;
import run.halo.app.model.params.PostQuery;
......@@ -107,6 +108,19 @@ public class PostController {
return postService.updateBy(postToUpdate, postParam.getTagIds(), postParam.getCategoryIds());
}
@PutMapping("{postId:\\d+}/{status}")
public void updateStatusBy(
@PathVariable("postId") Integer postId,
@PathVariable("status") PostStatus status) {
Post post = postService.getById(postId);
// Set status
post.setStatus(status);
// Update
postService.update(post);
}
@DeleteMapping("{postId:\\d+}")
public void deletePermanently(@PathVariable("postId") Integer postId) {
// Remove it
......
......@@ -58,7 +58,12 @@ public class SheetController {
public SheetDetailDTO updateBy(
@PathVariable("sheetId") Integer sheetId,
@RequestBody @Valid SheetParam sheetParam) {
Sheet sheet = sheetService.updateBy(sheetParam.convertTo());
Sheet sheetToUpdate = sheetService.getById(sheetId);
sheetParam.update(sheetToUpdate);
Sheet sheet = sheetService.updateBy(sheetToUpdate);
return sheetService.convertToDetailDto(sheet);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册