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,

View File

@@ -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 });

View File

@@ -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}`);
// }
});