mirror of https://github.com/halo-dev/halo
Fixed sheet update error.
parent
4a46132ffe
commit
93eb1250f7
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue