feat: update event file and session search to support V3 API filters
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user