rymghosn opened a new pull request, #6537: URL: https://github.com/apache/fineract/pull/6537
## Description JIRA: https://issues.apache.org/jira/browse/FINERACT-2873 Filtering the audit trail by status (`GET /v1/audits?status=<n>`, also with `paged=true`, and the v2 audits endpoint, which takes the same `AuditRequest` bean) fails with HTTP 500 on PostgreSQL: ``` org.springframework.jdbc.BadSqlGrammarException: ... ERROR: operator does not exist: smallint = character varying ``` `AuditReadPlatformServiceImpl.getExtraCriteria` adds `aud.status = ?` with `auditRequest.getStatus()` as the bind value, but `AuditRequest.status` is declared as a `String`. `SQLBuilder` passes it to `JdbcTemplate` as-is, so it is bound as `varchar` against the `smallint` column `m_portfolio_command_source.status`, which PostgreSQL rejects (MySQL/MariaDB coerce it silently). This PR declares `AuditRequest.status` as `Integer`, like the bean's other numeric filters (`resourceId`, `makerId`, `officeId`, ... are `Long`). No API change for valid requests; a non-numeric `status` is now rejected by JAX-RS parameter conversion instead of reaching the database. ### Testing - New `AuditReadPlatformServiceImplTest` (2 tests): the `aud.status = ?` criterion is bound as an `Integer`, and no criterion is added when `status` is absent. (On `develop` the first test does not compile, since `setStatus` takes a `String` there.) - Live on a local PostgreSQL instance booted with `bootRun`: - `develop` (`213f517b88`): `GET /v1/audits?status=1` and `GET /v1/audits?status=1&paged=true` return 500 with the error above; `GET /v1/audits?paged=true` returns 200 (58 entries). - With this PR: `?status=1&paged=true` returns 200 with 52 of the 58 entries, all `processingResult: Processed`; `?status=3&paged=true` returns 200 with an empty page; the unfiltered request is unchanged (58 entries). - `spotlessJavaCheck` passes. ## Checklist Please make sure these boxes are checked before submitting your pull request - thanks! - [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests) - [x] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers. - [x] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made. - [x] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions). - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes (not applicable: no API change) - [x] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute). - [x] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately. - [x] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy). Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
