Fix: Restore specialized search logic for Event Sessions and Presenters
This commit is contained in:
@@ -331,6 +331,91 @@ export async function update_ae_obj__event_presentation({
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2026-01-21 to Restore Full Aether Search Logic
|
||||
export async function search__event_presentation({
|
||||
api_cfg,
|
||||
event_id,
|
||||
fulltext_search_qry_str = '',
|
||||
like_search_qry_str = '',
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
order_by_li = [
|
||||
{ sort: 'ASC' },
|
||||
{ start_datetime: 'ASC' },
|
||||
{ name: 'ASC' }
|
||||
],
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
fulltext_search_qry_str?: string;
|
||||
like_search_qry_str?: string;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled';
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden';
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: any;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresentation[]> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** search__event_presentation() *** [V3] event_id=${event_id} ft=${fulltext_search_qry_str}`);
|
||||
}
|
||||
|
||||
const search_query: any = {
|
||||
q: '',
|
||||
and: [{ field: 'event_id_random', op: 'eq', value: event_id }]
|
||||
};
|
||||
|
||||
const params: key_val = {};
|
||||
|
||||
// Restore Fulltext logic
|
||||
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
|
||||
params['ft_qry'] = { 'default_qry_str': fulltext_search_qry_str };
|
||||
}
|
||||
|
||||
// Restore Like logic
|
||||
if (like_search_qry_str) {
|
||||
params['lk_qry'] = { 'default_qry_str': like_search_qry_str };
|
||||
}
|
||||
|
||||
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 });
|
||||
|
||||
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
|
||||
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
|
||||
|
||||
const result_li = await api.search_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'event_presentation',
|
||||
search_query,
|
||||
order_by_li,
|
||||
params,
|
||||
limit,
|
||||
offset,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result_li && try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__event_presentation_props({
|
||||
obj_li: result_li,
|
||||
log_lvl
|
||||
});
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presentation',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
return result_li || [];
|
||||
}
|
||||
|
||||
export const properties_to_save = [
|
||||
'id',
|
||||
'event_presentation_id',
|
||||
@@ -365,6 +450,7 @@ export const properties_to_save = [
|
||||
|
||||
/**
|
||||
* NON-EXPORTED LOCAL HELPER
|
||||
* Processes a list of Aether objects by applying common and specific transformations.
|
||||
*/
|
||||
async function _process_generic_props<T extends Record<string, any>>({
|
||||
obj_li,
|
||||
|
||||
Reference in New Issue
Block a user