dev add method link
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-04 11:09:52 +07:00
parent bbc2508a9e
commit b19abf32e9
@@ -116,43 +116,44 @@ public class LawCaseHandler implements RequestHandler {
}
private void validateLawCaseRequestFilters(LawCaseRequest lawCaseRequest) {
if (lawCaseRequest.getFilterType() != null && !lawCaseRequest.getFilterType().getName().isEmpty()) {
boolean isValidType = Arrays.stream(LawCaseType.values())
.anyMatch(type -> type.getName().equalsIgnoreCase(lawCaseRequest.getFilterType().name()));
if (!isValidType) {
throw new NotValidFieldException("Not valid filter type",
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
MessageCode.NOT_VALID_FIELD.getDescription(),
Map.of("field", "filterType",
"valid_values", Arrays.stream(LawCaseType.values())
.map(LawCaseType::getName)
.collect(Collectors.toList()),
"received_value", lawCaseRequest.getFilterType())));
}
}
if (lawCaseRequest.getFilterPriority() != null && !lawCaseRequest.getFilterPriority().name().isEmpty()) {
boolean isValidPriority = Arrays.stream(LawCasePriority.values())
.anyMatch(priority ->
priority.name().equalsIgnoreCase(lawCaseRequest.getFilterPriority().name()));
if (!isValidPriority) {
throw new NotValidFieldException("Not valid filter priority",
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
MessageCode.NOT_VALID_FIELD.getDescription(),
Map.of("field", "filterPriority",
"valid_values", Arrays.stream(LawCasePriority.values())
.map(LawCasePriority::name)
.collect(Collectors.toList()),
"received_value", lawCaseRequest.getFilterPriority())));
}
}
// if (lawCaseRequest.getFilterType() != null && !lawCaseRequest.getFilterType().getName().isEmpty()) {
// boolean isValidType = Arrays.stream(LawCaseType.values())
// .anyMatch(type -> type.getName().equalsIgnoreCase(lawCaseRequest.getFilterType().name()));
//
// if (!isValidType) {
// throw new NotValidFieldException("Not valid filter type",
// new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
// MessageCode.NOT_VALID_FIELD.getDescription(),
// Map.of("field", "filterType",
// "valid_values", Arrays.stream(LawCaseType.values())
// .map(LawCaseType::getName)
// .collect(Collectors.toList()),
// "received_value", lawCaseRequest.getFilterType())));
// }
// }
//
// if (lawCaseRequest.getFilterPriority() != null && !lawCaseRequest.getFilterPriority().name().isEmpty()) {
// boolean isValidPriority = Arrays.stream(LawCasePriority.values())
// .anyMatch(priority ->
// priority.name().equalsIgnoreCase(lawCaseRequest.getFilterPriority().name()));
//
// if (!isValidPriority) {
// throw new NotValidFieldException("Not valid filter priority",
// new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
// MessageCode.NOT_VALID_FIELD.getDescription(),
// Map.of("field", "filterPriority",
// "valid_values", Arrays.stream(LawCasePriority.values())
// .map(LawCasePriority::name)
// .collect(Collectors.toList()),
// "received_value", lawCaseRequest.getFilterPriority())));
// }
// }
if (lawCaseRequest.getFilterPriority() != null && lawCaseRequest.getFilterPriority() != LawCasePriority.HIGH &&
lawCaseRequest.getFilterPriority() != LawCasePriority.MIDDLE &&
lawCaseRequest.getFilterPriority() != LawCasePriority.LOW &&
lawCaseRequest.getFilterPriority() != LawCasePriority.CRITICAL) {
throw new NotValidFieldException("Not valid filter priority",
new BaseResponse(null, MessageCode.NOT_VALID_FIELD.getCode(),
MessageCode.NOT_VALID_FIELD.getDescription(),