feat: update event file and session search to support V3 API filters

This commit is contained in:
Scott Idem
2026-01-29 15:51:41 -05:00
parent 6c8118fc82
commit 99345c93a9
3 changed files with 49 additions and 14 deletions

View File

@@ -189,7 +189,7 @@ export async function create_event_file_obj_from_hosted_file_async({
});
if (return_obj) return result;
return result?.event_file_id_random;
return result?.event_file_id || result?.id || result?.event_file_id_random;
}
// Updated 2026-01-20 to V3
@@ -269,7 +269,9 @@ export async function search__event_file({
api_cfg,
event_id,
qry_str = '',
min_file_size = null,
qry_created_on = null,
qry_min_file_size = null,
qry_file_purpose = null,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 25,
@@ -285,7 +287,9 @@ export async function search__event_file({
api_cfg: any;
event_id: string;
qry_str?: string;
min_file_size?: null | number;
qry_created_on?: string | null;
qry_min_file_size?: null | number;
qry_file_purpose?: string | null;
enabled?: 'enabled' | 'all' | 'not_enabled';
hidden?: 'hidden' | 'all' | 'not_hidden';
limit?: number;
@@ -296,17 +300,27 @@ export async function search__event_file({
}): Promise<ae_EventFile[]> {
const search_query: any = {
q: qry_str,
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
and: [{ field: 'event_id', op: 'eq', value: event_id }]
};
if (min_file_size) {
search_query.and.push({ field: 'hosted_file_size', op: 'gt', value: min_file_size });
if (qry_min_file_size) {
search_query.and.push({ field: 'hosted_file_size', op: 'gt', value: qry_min_file_size });
}
if (qry_created_on) {
search_query.and.push({ field: 'created_on', op: 'gte', value: qry_created_on });
}
if (qry_file_purpose) {
search_query.and.push({ field: 'file_purpose', op: 'eq', value: qry_file_purpose });
}
const result_li = await api.search_ae_obj_v3({
api_cfg,
obj_type: 'event_file',
search_query,
enabled,
hidden,
order_by_li,
limit,
offset,