Package com.bytedesk.forum.post
Class PostController
java.lang.Object
com.bytedesk.forum.post.PostController
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<PostEntity>
createPost
(String title, String content, org.springframework.security.core.userdetails.UserDetails userDetails, Long categoryId) org.springframework.http.ResponseEntity<Void>
deletePost
(Long postId) org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>>
fullTextSearch
(String keyword, org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>>
fullTextSearchByCategory
(String keyword, Long categoryId, org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity<PostEntity>
org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>>
getPosts
(org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>>
getPostsByCategory
(Long categoryId, org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>>
getPostsByUser
(Long userId, org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity<Void>
incrementLikeCount
(Long postId) org.springframework.http.ResponseEntity<Void>
incrementViewCount
(Long postId) org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>>
searchPosts
(PostSearchCriteria criteria, org.springframework.data.domain.Pageable pageable) org.springframework.http.ResponseEntity<PostEntity>
updatePost
(Long postId, String title, String content)
-
Field Details
-
postService
-
categoryRepository
-
-
Constructor Details
-
PostController
public PostController()
-
-
Method Details
-
createPost
@PostMapping @PreAuthorize("isAuthenticated()") public org.springframework.http.ResponseEntity<PostEntity> createPost(@RequestParam String title, @RequestParam String content, @AuthenticationPrincipal org.springframework.security.core.userdetails.UserDetails userDetails, @RequestParam Long categoryId) -
updatePost
@PutMapping("/{postId}") @PreAuthorize("isAuthenticated() and @postService.isPostOwner(#postId, authentication.name)") public org.springframework.http.ResponseEntity<PostEntity> updatePost(@PathVariable Long postId, @RequestParam String title, @RequestParam String content) -
deletePost
-
getPost
@GetMapping("/{postId}") public org.springframework.http.ResponseEntity<PostEntity> getPost(@PathVariable Long postId) -
getPosts
@GetMapping public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>> getPosts(org.springframework.data.domain.Pageable pageable) -
getPostsByCategory
@GetMapping("/category/{categoryId}") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>> getPostsByCategory(@PathVariable Long categoryId, org.springframework.data.domain.Pageable pageable) -
getPostsByUser
@GetMapping("/user/{userId}") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>> getPostsByUser(@PathVariable Long userId, org.springframework.data.domain.Pageable pageable) -
incrementViewCount
-
incrementLikeCount
-
searchPosts
@PostMapping("/search") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>> searchPosts(@RequestBody PostSearchCriteria criteria, org.springframework.data.domain.Pageable pageable) -
fullTextSearch
@GetMapping("/search/fulltext") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>> fullTextSearch(@RequestParam String keyword, org.springframework.data.domain.Pageable pageable) -
fullTextSearchByCategory
@GetMapping("/search/fulltext/category/{categoryId}") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<PostEntity>> fullTextSearchByCategory(@RequestParam String keyword, @PathVariable Long categoryId, org.springframework.data.domain.Pageable pageable)
-