mirror of https://github.com/halo-dev/halo
Refactor listTags api
parent
836e9975e8
commit
a8eb88956c
|
@ -70,7 +70,7 @@ public class CommentController {
|
|||
}
|
||||
|
||||
@PutMapping("{commentId:\\d+}/status/{status}")
|
||||
@ApiOperation("Update comment status")
|
||||
@ApiOperation("Updates comment status")
|
||||
public CommentOutputDTO updateStatusBy(@PathVariable("commentId") Long commentId,
|
||||
@PathVariable("status") CommentStatus status) {
|
||||
// Update comment status
|
||||
|
@ -80,6 +80,7 @@ public class CommentController {
|
|||
}
|
||||
|
||||
@DeleteMapping("{commentId:\\d+}")
|
||||
@ApiOperation("Deletes comment permanently and recursively")
|
||||
public CommentOutputDTO deleteBy(@PathVariable("commentId") Long commentId) {
|
||||
// Get comment by id
|
||||
Comment comment = commentService.getById(commentId);
|
||||
|
|
|
@ -39,23 +39,23 @@ public class GalleryController {
|
|||
/**
|
||||
* Get gallery by id.
|
||||
*
|
||||
* @param id gallery id
|
||||
* @param galleryId gallery id
|
||||
* @return GalleryOutputDTO
|
||||
*/
|
||||
@GetMapping("{id:\\d+}")
|
||||
@GetMapping("{galleryId:\\d+}")
|
||||
@ApiOperation("Get gallery detail by id")
|
||||
public GalleryOutputDTO getBy(@PathVariable("id") Integer id) {
|
||||
return new GalleryOutputDTO().convertFrom(galleryService.getById(id));
|
||||
public GalleryOutputDTO getBy(@PathVariable("galleryId") Integer galleryId) {
|
||||
return new GalleryOutputDTO().convertFrom(galleryService.getById(galleryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete gallery by id.
|
||||
*
|
||||
* @param id id
|
||||
* @param galleryId gallery id
|
||||
*/
|
||||
@DeleteMapping("{id:\\d+}")
|
||||
@DeleteMapping("{galleryId:\\d+}")
|
||||
@ApiOperation("Delete gallery by id")
|
||||
public void deletePermanently(@PathVariable("id") Integer id) {
|
||||
galleryService.removeById(id);
|
||||
public void deletePermanently(@PathVariable("galleryId") Integer galleryId) {
|
||||
galleryService.removeById(galleryId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ public class PostController {
|
|||
@GetMapping("status/{status}")
|
||||
@ApiOperation("Gets a page of post by post status")
|
||||
public Page<? extends PostSimpleOutputDTO> pageByStatus(@PathVariable(name = "status") PostStatus status,
|
||||
@RequestParam(value = "more_info", required = false, defaultValue = "false") Boolean moreInfo,
|
||||
@RequestParam(value = "more", required = false, defaultValue = "false") Boolean more,
|
||||
@PageableDefault(sort = "updateTime", direction = DESC) Pageable pageable) {
|
||||
if (moreInfo) {
|
||||
if (more) {
|
||||
return postService.pageListVoBy(status, pageable);
|
||||
}
|
||||
return postService.pageSimpleDtoByStatus(status, pageable);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cc.ryanc.halo.web.controller.admin.api;
|
||||
|
||||
import cc.ryanc.halo.model.dto.TagOutputDTO;
|
||||
import cc.ryanc.halo.model.dto.TagWithCountOutputDTO;
|
||||
import cc.ryanc.halo.model.entity.Tag;
|
||||
import cc.ryanc.halo.model.params.TagParam;
|
||||
import cc.ryanc.halo.service.PostTagService;
|
||||
|
@ -36,13 +35,12 @@ public class TagController {
|
|||
this.postTagService = postTagService;
|
||||
}
|
||||
|
||||
@GetMapping("/addition")
|
||||
public List<TagWithCountOutputDTO> listTagsWithCount(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) {
|
||||
@GetMapping
|
||||
public List<? extends TagOutputDTO> listTags(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort,
|
||||
@RequestParam(name = "more", required = false, defaultValue = "false") Boolean more) {
|
||||
if (more) {
|
||||
return postTagService.listTagWithCountDtos(sort);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public List<TagOutputDTO> listTags(@SortDefault(sort = "updateTime", direction = Sort.Direction.DESC) Sort sort) {
|
||||
return tagService.convertTo(tagService.listAll(sort));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue