-
Estimated Time: 3 hours
-
30m — Define
IssueSpecificationclass and implementSpecification<Issue>methods for:statuspriorityseverityprojectId- (optional)
assigneeId,reporterId
-
30m — Update
IssueRepositoryto extendJpaSpecificationExecutor<Issue>, and revise controller to:- Accept query parameters via
@RequestParam - Compose dynamic
Specificationbased on inputs
- Accept query parameters via
-
1h — Write unit tests to cover:
- All combinations of query parameters
- Empty queries (return all)
- Edge cases (invalid enums, etc.)
-
1h — Write integration tests (H2 or PostgreSQL):
- Seed multiple issues with different statuses/priorities
- Validate filtering combinations work as expected
-
-
Work Summary
This task improves backend support for the upcoming Sztab web UI by enhancing the
IssueControllerwith:- Pagination validation for
getIssuesByFilter(...) - Graceful handling of bad requests (invalid page/size)
- Aligned controller and service method signatures
- Updated
IssueServiceandIssueServiceImpl - Improved JPA
IssueSpecificationfor dynamic filtering - Expanded unit test coverage:
IssueControllerTest.java: full endpoint coverage including invalid paginationIssueServiceImplTest.java: full path coverage with valid/invalid filters
Motivation
The web UI requires paginated and filtered access to issues. This change ensures:
- Robust API behavior even when pagination inputs are invalid
- Predictable results for large issue sets
- A working backend scaffold for the upcoming frontend work
Changes Made
Controller
IssueControllernow returns400 Bad Requestforpage < 0orsize <= 0- Swagger annotations were preserved
- All controller methods use consistent Javadoc and
@PreAuthorizeroles
Service
getIssuesByFilter(...)now takesPageableand filter fields- JPA
IssueSpecificationnow lives in its own class
Tests
IssueControllerTest.java: added cases for invalid pagination and filter usageIssueServiceImplTest.java: verified full filtering logic including enums, nulls, and edge cases
Related Branch
improvement/sz26-sztab-backend-for-web-uiTarget Branch
wolnosc(merged and pushed)Status
- Merged
- Pushed
- No PR needed (already fully merged into target)
- Pagination validation for
-
Worklog
Date Time Spent Task 2025-10-29 1h 15m Reviewed existing IssueControllerand service methods for pagination handling2025-10-29 1h 00m Refactored IssueControllerto validate page/size params and return 400s2025-10-29 1h 30m Introduced IssueSpecificationfor dynamic filtering and updated service methods2025-10-29 1h 00m Wrote unit tests for IssueServiceImplincluding filter variants2025-10-30 1h 00m Expanded IssueControllerTestwith invalid pagination cases2025-10-30 0h 15m Merged into wolnosc, pushed both branches, and verified sync on OneDev
Total time: 6h 0m
| Type |
Improvement
|
| Priority |
Major
|
| Assignee | |
| Version |
none
|
| Sprints |
n/a
|
| Customer |
n/a
|
Issue Votes (0)
Goal
Implement dynamic filtering for the
Issueentity to support the following query parameters, in preparation for UI integration:statuspriorityseverityprojectIdassigneeIdandreporterIdThis is required to support Issue List views in the first version of the Sztab UI.
Tasks
IssueSpecificationutility class with staticSpecification<Issue>methods for each filterable field.IssueRepositoryto extendJpaSpecificationExecutor<Issue>.Estimated Time: 3 hours
Specificationmethods for filtersNotes
UserSpecification,ProjectSpecification, etc.IssueStatus,IssuePriority,IssueSeverityfinalon all method parameters