This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user