dev add complaint all info with pagination
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-26 13:21:01 +07:00
parent 4a85e415a7
commit 16791d35de
4 changed files with 201 additions and 189 deletions
@@ -228,9 +228,22 @@ public class ModerationService {
);
}
/**
* Получение апелляций пользователя
*/
@Transactional(readOnly = true)
public Page<FileEntity> getFilesForModeration(int page, int size, String sortDirection, String sortBy) {
if (sortDirection == null || sortDirection.isEmpty()) {
sortDirection = "desc";
}
if (sortBy == null || sortBy.isEmpty()) {
sortBy = "createdAt";
}
Pageable pageable = PageRequest.of(page, size, Sort.by(Sort.Direction.fromString(sortDirection), sortBy));
return fileEntityRepository.findByStatusIn(Arrays.asList(FileStatus.MODERATION, FileStatus.BLOCKED), pageable);
}
@Transactional(readOnly = true)
public Page<AppealResponse> getUserAppeals(Long userId, int page, int size) {
Pageable pageable = PageRequest.of(page, size, Sort.by("createdAt").descending());
@@ -238,6 +251,23 @@ public class ModerationService {
.map(this::convertToResponse);
}
@Transactional(readOnly = true)
public Page<AppealResponse> getAllAppeals(int page, int size, String sortDirection, String sortBy) {
if (sortDirection == null || sortDirection.isEmpty()) {
sortDirection = "desc";
}
if (sortBy == null || sortBy.isEmpty()) {
sortBy = "createdAt";
}
Pageable pageable = PageRequest.of(page, size,
Sort.by(Sort.Direction.fromString(sortDirection), sortBy));
return fileAppealRepository.findAll(pageable)
.map(this::convertToResponse);
}
private AppealResponse convertToResponse(FileAppeal appeal) {
return AppealResponse.builder()
.appealId(appeal.getId())