FilterIdentities filters identities using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format. Request body format: { "filters": [ {"field": "first_name", "operator": "eq", "value": "John"}, {"field": "category", "operator": "in", "values":
(c *gin.Context)
| 220 | // - 400 Bad Request: If there's an error parsing the filters or retrieving identities. |
| 221 | // - 200 OK: If the identities are successfully retrieved. |
| 222 | func (a Api) FilterIdentities(c *gin.Context) { |
| 223 | filters, opts, limit, offset, err := ParseFiltersFromBody(c, "identity") |
| 224 | if err != nil { |
| 225 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 226 | return |
| 227 | } |
| 228 | |
| 229 | resp, count, err := a.ledgerforge.GetAllIdentitiesWithFilterAndOptions(c.Request.Context(), filters, opts, limit, offset) |
| 230 | if err != nil { |
| 231 | c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
| 232 | return |
| 233 | } |
| 234 | |
| 235 | if opts.IncludeCount { |
| 236 | c.JSON(http.StatusOK, FilterResponse{Data: resp, TotalCount: count}) |
| 237 | } else { |
| 238 | c.JSON(http.StatusOK, resp) |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | // TokenizeIdentityField tokenizes a specific field in an identity. |
| 243 | // It extracts the identity ID and field name from the route parameters, |
nothing calls this directly
no test coverage detected