added EP rejected posts for admin
This commit is contained in:
@@ -38,6 +38,7 @@ public class PostAdminController {
|
||||
|
||||
private final AdminPostService adminPostService;
|
||||
|
||||
/** Основная лента: только ACTIVE и CLOSED. */
|
||||
@GetMapping
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public ResponseEntity<Page<AdminPostResponse>> getPosts(
|
||||
@@ -51,6 +52,20 @@ public class PostAdminController {
|
||||
return ResponseEntity.ok(adminPostService.getPosts(search, type, status, pageable));
|
||||
}
|
||||
|
||||
/** Отклонённые объявления: те же фильтры, но статус зафиксирован на REJECTED. */
|
||||
@GetMapping("/rejected")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public ResponseEntity<Page<AdminPostResponse>> getRejectedPosts(
|
||||
@RequestParam(required = false) String search,
|
||||
@RequestParam(required = false) String type,
|
||||
@RequestParam(required = false) String status,
|
||||
@PageableDefault(size = 20, sort = "createdAt", direction = Sort.Direction.DESC)
|
||||
Pageable pageable
|
||||
) {
|
||||
log.info("getRejectedPosts search={} type={} status={} page={}", search, type, status, pageable.getPageNumber());
|
||||
return ResponseEntity.ok(adminPostService.getRejectedPosts(search, type, status, pageable));
|
||||
}
|
||||
|
||||
/** Multipart-поля те же, что у пользовательского PUT /api/v1/posts/{id}. */
|
||||
@PutMapping(value = "/{postId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
|
||||
Reference in New Issue
Block a user