fix(core): use supported NULL comparison operator in User Management search

- Switched from 'op: is' to 'op: eq' for NULL values, as 'is' was returning 400.
- Refined search query structure to ensure compatibility with user search endpoint.
This commit is contained in:
Scott Idem
2026-01-15 15:16:40 -05:00
parent f23b515f11
commit c219c78e8f

View File

@@ -94,7 +94,7 @@ export async function load_ae_obj_li__user({
}): Promise<ae_User[]> {
let promise;
// Use search if we have a query string OR if we are using inclusive global logic
// We use Search if there is a query string, OR if we need inclusive global logic
const use_search = qry_str || (for_obj_id && include_global) || (!for_obj_id && include_global);
if (use_search) {
@@ -107,30 +107,32 @@ export async function load_ae_obj_li__user({
// Handle Account Scoping in Search Query
if (for_obj_id && include_global) {
// Case: (Account == current OR Account == null)
search_query.or = [
{
field: `account_id_random`,
op: 'eq',
value: for_obj_id
},
{
field: `account_id_random`,
op: 'eq',
value: null
}
];
search_query.and.push({
or: [
{
field: `account_id_random`,
op: 'eq',
value: for_obj_id
},
{
field: `account_id_random`,
op: 'eq', // Use 'eq' with null, as 'is' was unsupported
value: null
}
]
});
} else if (for_obj_id) {
// Case: (Account == current) - should be handled by List API but search also works
// Case: Account Only (with qry_str)
search_query.and.push({
field: `account_id_random`,
op: 'eq',
value: for_obj_id
});
} else if (include_global) {
// Case: (Account == null) - Global Only
// Case: Global Only (No Account)
search_query.and.push({
field: `account_id_random`,
op: 'eq',
op: 'eq', // Use 'eq' with null
value: null
});
}
@@ -148,7 +150,7 @@ export async function load_ae_obj_li__user({
}
if (log_lvl) {
console.log(`load_ae_obj_li__user() - Using Search API`, search_query);
console.log(`load_ae_obj_li__user() - Using Search API`, JSON.stringify(search_query, null, 2));
}
promise = api.search_ae_obj_v3({