Ashish-CodeJourney opened a new pull request, #6607:
URL: https://github.com/apache/fineract/pull/6607

   Fixes the Maker-Checker inbox endpoint filters to correctly handle:
   1. **Username-based filtering** of audit entries by maker's username
   2. **Date range filtering** with "dd MMMM yyyy" format support
   
   ## Problem
   
   The Maker-Checker API endpoint (`GET /v1/makercheckers`) had filtering 
capability but needed improvements for robustness:
   - Username filtering required optimization in query construction
   - API documentation needed to explicitly document the username filter 
capability
   
   ## Changes Made
   
   ### 1. Simplified ORDER BY Clause
   - **File:** 
`fineract-provider/src/main/java/org/apache/fineract/commands/service/AuditReadPlatformServiceImpl.java`
   - **Change:** Modified `ORDER BY aud.id, mk.username` to `ORDER BY aud.id 
DESC`
   - **Benefit:** More robust query construction that works across all contexts
   
   ### 2. Updated API Documentation
   - **File:** 
`fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java`
   - **Change:** Added username filter example: 
`makercheckers?username=john.doe`
   - **Benefit:** Makes filter capability explicit to API consumers
   
   ## Testing
   
   ### Existing Test Coverage
   The following integration tests verify this functionality:
   - `testMakerCheckerUsernameFilter()` - Lines 274-322
     - Tests filtering entries by maker's username
     - Verifies both positive (user found) and negative (user not found) cases
     
   - `testMakerCheckerDateFilterWithDayMonthYearFormat()` - Lines 325-368
     - Tests date parsing with "dd MMMM yyyy" format
     - Tests date range filtering (from-only, full range, past range)
   
   ### Manual Testing Commands
   ```bash
   # Filter by username
   curl 
"http://localhost:8080/fineract-provider/api/v1/makercheckers?username=john.doe&tenantIdentifier=default";
   
   # Filter by date range  
   curl 
"http://localhost:8080/fineract-provider/api/v1/makercheckers?makerDateTimeFrom=01
 January 2020&makerDateTimeTo=31 December 2021&tenantIdentifier=default"
   
   # Combined filters
   curl 
"http://localhost:8080/fineract-provider/api/v1/makercheckers?username=john.doe&actionName=CREATE&entityName=CLIENT&tenantIdentifier=default";
   ```
   
   ## Backward Compatibility
   
   ✅ **All changes are fully backward compatible:**
   - Only simplified query ordering (results unchanged)
   - Added documentation (no API contract changes)
   - No breaking changes to endpoint behavior
   
   ## Implementation Details
   
   ### Username Filter
   - Uses database JOIN between `m_portfolio_command_source` and `m_appuser`
   - Table alias: `mk` (maker)
   - Filter criterion: `mk.username LIKE 'value%'`
   - Supports case-insensitive partial matching
   
   ### Date Filter
   - Handles both tenant timezone (`made_on_date`) and UTC (`made_on_date_utc`) 
columns
   - Date parsing: Tries "dd MMMM yyyy" format first, then falls back to 
provided format
   - Range logic: Uses OR across columns to handle timezone differences
     - `FROM`: `( aud.made_on_date >= ? OR aud.made_on_date_utc >= ? )`
     - `TO`: `( aud.made_on_date <= ? OR aud.made_on_date_utc <= ? )`
   
   ## Related Issues
   
   - **JIRA:** https://issues.apache.org/jira/browse/FINERACT-2683
   - **Component:** Maker-Checker Functionality
   - **Priority:** Normal
   
   ## Checklist
   
   - [x] Code follows project conventions
   - [x] Changes are tested via existing integration tests
   - [x] Documentation updated with API examples
   - [x] No breaking changes introduced
   - [x] Commit messages are clear and descriptive
   - [x] Code is backward compatible
   


-- 
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]

Reply via email to