From 99345c93a9cfced4b5f00a2ac19e0e385553847c Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 29 Jan 2026 15:51:41 -0500 Subject: [PATCH] feat: update event file and session search to support V3 API filters --- src/lib/ae_events/ae_events__event_file.ts | 26 ++++++++++++++----- src/lib/ae_events/ae_events__event_session.ts | 23 +++++++++++++++- .../(pres_mgmt)/reports/reports_files.svelte | 14 +++++----- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/src/lib/ae_events/ae_events__event_file.ts b/src/lib/ae_events/ae_events__event_file.ts index 9a7caa54..22763453 100644 --- a/src/lib/ae_events/ae_events__event_file.ts +++ b/src/lib/ae_events/ae_events__event_file.ts @@ -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 { 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, diff --git a/src/lib/ae_events/ae_events__event_session.ts b/src/lib/ae_events/ae_events__event_session.ts index 4089bd39..0b218879 100644 --- a/src/lib/ae_events/ae_events__event_session.ts +++ b/src/lib/ae_events/ae_events__event_session.ts @@ -342,6 +342,10 @@ export async function search__event_session({ like_presenter_search_qry_str = '', like_poc_name_qry_str = '', location_name = null, + qry_files = null, + qry_poc_agree = null, + qry_poc_kv_json = null, + qry_start_datetime = null, enabled = 'enabled', hidden = 'not_hidden', limit = 50, @@ -363,6 +367,10 @@ export async function search__event_session({ like_presenter_search_qry_str?: string; like_poc_name_qry_str?: string; location_name?: null | string; + qry_files?: null | boolean; + qry_poc_agree?: null | boolean; + qry_poc_kv_json?: null | boolean; + qry_start_datetime?: string | null; enabled?: 'enabled' | 'all' | 'not_enabled'; hidden?: 'hidden' | 'all' | 'not_hidden'; limit?: number; @@ -377,7 +385,7 @@ export async function search__event_session({ const search_query: any = { q: '', - and: [{ field: 'event_id', op: 'eq', value: event_id }] + and: [{ field: 'event_id_random', op: 'eq', value: event_id }] }; const params: key_val = {}; @@ -410,6 +418,19 @@ export async function search__event_session({ search_query.and.push({ field: 'event_location_name', op: 'like', value: `%${location_name}%` }); } + if (qry_files !== null) { + if (qry_files === true) search_query.and.push({ field: 'file_count_all', op: 'gt', value: 0 }); + else search_query.and.push({ field: 'file_count_all', op: 'eq', value: 0 }); + } + + if (qry_poc_agree !== null) { + search_query.and.push({ field: 'poc_agree', op: 'eq', value: qry_poc_agree ? 1 : 0 }); + } + + if (qry_start_datetime) { + search_query.and.push({ field: 'start_datetime', op: 'gte', value: qry_start_datetime }); + } + if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 }); else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 }); diff --git a/src/routes/events/[event_id]/(pres_mgmt)/reports/reports_files.svelte b/src/routes/events/[event_id]/(pres_mgmt)/reports/reports_files.svelte index 5bdfe472..28e2c3a2 100644 --- a/src/routes/events/[event_id]/(pres_mgmt)/reports/reports_files.svelte +++ b/src/routes/events/[event_id]/(pres_mgmt)/reports/reports_files.svelte @@ -343,21 +343,21 @@ .finally(() => { if (log_lvl) { console.log( - 'TEST SEARCH - Search done. Pulling out the event_file_id_randoms.' + 'TEST SEARCH - Search done. Pulling out the event_file_ids.' ); } // console.log(`TEST search: ${$lq_kv__event_file_obj_li}`); - // event_file_id_random_li = []; + // event_file_id_li = []; - // We need to loop through the array of objects and get the event_file_id_random from each object a new list of event_file_id_randoms. Then we can use this list to get the full objects from the database. + // We need to loop through the array of objects and get the event_file_id from each object a new list of event_file_ids. Then we can use this list to get the full objects from the database. // let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery. // for (let i = 0; i < $events_slct.event_file_obj_li.length; i++) { - // tmp_li.push($events_slct.event_file_obj_li[i].event_file_id_random); + // tmp_li.push($events_slct.event_file_obj_li[i].event_file_id); // } - // event_file_id_random_li = tmp_li; + // event_file_id_li = tmp_li; - // event_file_id_random_li = $events_slct.event_file_obj_li.map(file_obj => file_obj.event_file_id_random); + // event_file_id_li = $events_slct.event_file_obj_li.map(file_obj => file_obj.event_file_id); // Finally done with the search. $events_sess.pres_mgmt.status_qry__search = 'done'; @@ -366,7 +366,7 @@ qry__status = 'done'; // if (log_lvl > 1) { - // console.log(`TEST SEARCH - event_file_id_random_li:`, event_file_id_random_li); + // console.log(`TEST SEARCH - event_file_id_li:`, event_file_id_li); // // console.log(`TEST SEARCH - search live query: ${$lq_kv__event_file_obj_li}`); // } });