Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces new filtering capabilities—including trust level, active status, and search—to the agent and identity listing endpoints. The changes extend from the API handlers through the service layer to the Postgres repository implementation. Feedback highlights that the identity repository lacks server-side pagination, which may cause performance degradation as data grows. Additionally, the new filters are not yet exposed in the identity API handler, and the boolean logic for the active status filter is currently implemented using fragile string comparisons.
| if isActive != "" { | ||
| if isActive == "true" { | ||
| q = q.Where("status = 'active'") | ||
| } else if isActive == "false" { | ||
| q = q.Where("status != 'active'") | ||
| } | ||
| } |
There was a problem hiding this comment.
The isActive filter logic relies on exact string matches for "true" and "false". This is fragile as it doesn't handle different casings or invalid values gracefully. Consider using a boolean type in the API handler and passing it down, or using strconv.ParseBool to handle the string input more robustly.
Summary
Type of change
Testing
Impact / Risks
📸 Screenshots / Logs (if applicable)