dev add violation link
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-04-07 15:35:32 +07:00
parent 9e81b45922
commit 29ed74745f
6 changed files with 19 additions and 15 deletions
@@ -21,7 +21,7 @@ public class LawCaseService {
private final LawCaseRepository lawCaseRepository;
public LawCase addLawCase(BigDecimal amount, String description, String name,
LawCasePriority priority) {
LawCasePriority priority, Long violationId) {
LawCase lawCase = new LawCase();
BigDecimal damage = amount == null ? BigDecimal.ZERO : amount;
@@ -30,6 +30,7 @@ public class LawCaseService {
lawCase.setName(name);
lawCase.setDescription(description);
lawCase.setPriority(priority);
lawCase.setViolationId(violationId);
return lawCaseRepository.save(lawCase);
}
@@ -67,25 +68,16 @@ public class LawCaseService {
return lawCaseRepository.save(lawCase);
}
public List<LawCase> getAllUserLawCases(Long userId, int pageSize, int pageNumber, String propertySort,
String ascDesc) {
Sort.Direction direction = ascDesc.equalsIgnoreCase("desc") ? Sort.Direction.DESC:
Sort.Direction.ASC;
Sort sort = Sort.by(direction, propertySort);
Pageable pageable = PageRequest.of(pageNumber, pageSize, sort);
return lawCaseRepository.getUserLawCases(userId, pageable);
}
public Page<LawCase> getAllUserLawCases(Long userId, int pageSize, int pageNumber,
LawCaseType lawCaseType, String lawyer,
LawCasePriority lawCasePriority,
Long violationId,
String propertySort, String ascDesc) {
Sort.Direction direction = ascDesc.equalsIgnoreCase("desc") ? Sort.Direction.DESC : Sort.Direction.ASC;
Sort sort = Sort.by(direction, propertySort);
Pageable pageable = PageRequest.of(pageNumber, pageSize, sort);
return lawCaseRepository.getUserLawCases(userId, lawCaseType, lawyer, lawCasePriority, pageable);
return lawCaseRepository.getUserLawCases(userId, lawCaseType, lawyer, lawCasePriority, violationId, pageable);
}
public void deleteById(Long id) {