|
|
|
|
@@ -193,7 +193,11 @@ export async function load_ae_obj_li__event({
|
|
|
|
|
if (for_obj_id) {
|
|
|
|
|
search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id });
|
|
|
|
|
}
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
>>>>>>> f77938c1 (Fix(Events): Isolate IDAA Search to V2 and Refine V3 Search Pattern)
|
|
|
|
|
promise = api.search_ae_obj_v3({
|
|
|
|
|
api_cfg,
|
|
|
|
|
obj_type: 'event',
|
|
|
|
|
@@ -450,20 +454,27 @@ export async function qry_ae_obj_li__event({
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
=======
|
|
|
|
|
>>>>>>> f77938c1 (Fix(Events): Isolate IDAA Search to V2 and Refine V3 Search Pattern)
|
|
|
|
|
// Use raw field name to bypass backend mapping conflicts (Integer Trap)
|
|
|
|
|
if (for_obj_id) {
|
|
|
|
|
search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id });
|
|
|
|
|
}
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
=======
|
|
|
|
|
// Use raw field name to bypass backend mapping conflicts
|
|
|
|
|
// if (for_obj_id) {
|
|
|
|
|
// search_query.and.push({ field: 'account_id_random', op: 'eq', value: for_obj_id });
|
|
|
|
|
// }
|
|
|
|
|
>>>>>>> 63c633f5 (Fix(Events): Revert to URL-based account context for V3 Search)
|
|
|
|
|
=======
|
|
|
|
|
>>>>>>> f77938c1 (Fix(Events): Isolate IDAA Search to V2 and Refine V3 Search Pattern)
|
|
|
|
|
|
|
|
|
|
const result_li = await api.search_ae_obj_v3({
|
|
|
|
|
api_cfg,
|
|
|
|
|
obj_type: 'event',
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
// Inject header context for Auth but keep body context for Filtering
|
|
|
|
|
headers: { 'x-account-id': for_obj_id },
|
|
|
|
|
@@ -472,6 +483,10 @@ export async function qry_ae_obj_li__event({
|
|
|
|
|
for_obj_id,
|
|
|
|
|
// Pass account context via search query body instead of query params to avoid duplicate mapping
|
|
|
|
|
>>>>>>> 63c633f5 (Fix(Events): Revert to URL-based account context for V3 Search)
|
|
|
|
|
=======
|
|
|
|
|
// Inject header context for Auth but keep body context for Filtering
|
|
|
|
|
headers: { 'x-account-id': for_obj_id },
|
|
|
|
|
>>>>>>> f77938c1 (Fix(Events): Isolate IDAA Search to V2 and Refine V3 Search Pattern)
|
|
|
|
|
search_query,
|
|
|
|
|
enabled,
|
|
|
|
|
hidden,
|
|
|
|
|
@@ -506,17 +521,11 @@ export async function qry_ae_obj_li__event({
|
|
|
|
|
|
|
|
|
|
// Client-side Filter Layer
|
|
|
|
|
return result_li.filter((ev: any) => {
|
|
|
|
|
// 1. Conference filter - normalize 0/1 to boolean
|
|
|
|
|
if (qry_conference !== null && !!ev.conference !== !!qry_conference) return false;
|
|
|
|
|
|
|
|
|
|
// 2. Physical filter
|
|
|
|
|
if (qry_physical !== null && !!ev.physical !== !!qry_physical) return false;
|
|
|
|
|
|
|
|
|
|
// 3. Virtual filter
|
|
|
|
|
if (qry_virtual !== null && !!ev.virtual !== !!qry_virtual) return false;
|
|
|
|
|
|
|
|
|
|
// 4. Type filter (string)
|
|
|
|
|
if (qry_type !== null && ev.type !== qry_type) return false;
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
>>>>>>> ef26a01b (Fix(IDAA): Revert account_id body injection for Events V3 search)
|
|
|
|
|
|
|
|
|
|
if (try_cache) {
|
|
|
|
|
@@ -557,6 +566,8 @@ export async function qry_ae_obj_li__event({
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle person ID filter
|
|
|
|
|
=======
|
|
|
|
|
>>>>>>> f77938c1 (Fix(Events): Isolate IDAA Search to V2 and Refine V3 Search Pattern)
|
|
|
|
|
if (qry_person_id) {
|
|
|
|
|
const match = (
|
|
|
|
|
ev.external_person_id === qry_person_id ||
|
|
|
|
|
@@ -567,7 +578,106 @@ export async function qry_ae_obj_li__event({
|
|
|
|
|
);
|
|
|
|
|
if (!match) return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Specialized search function for IDAA module using legacy V2 endpoints.
|
|
|
|
|
* This is isolated to prevent V3 migration bugs from affecting Recovery Meetings.
|
|
|
|
|
*/
|
|
|
|
|
// Updated 2026-01-20
|
|
|
|
|
export async function qry_ae_obj_li__event_v2({
|
|
|
|
|
api_cfg,
|
|
|
|
|
for_obj_type = 'account',
|
|
|
|
|
for_obj_id,
|
|
|
|
|
qry_str,
|
|
|
|
|
qry_person_id = null,
|
|
|
|
|
qry_conference = null,
|
|
|
|
|
qry_physical = null,
|
|
|
|
|
qry_virtual = null,
|
|
|
|
|
qry_type = null,
|
|
|
|
|
enabled = 'enabled',
|
|
|
|
|
hidden = 'not_hidden',
|
|
|
|
|
view = 'default',
|
|
|
|
|
limit = 99,
|
|
|
|
|
offset = 0,
|
|
|
|
|
order_by_li = { start_datetime: 'DESC' } as const,
|
|
|
|
|
try_cache = true,
|
|
|
|
|
log_lvl = 0
|
|
|
|
|
}: {
|
|
|
|
|
api_cfg: any;
|
|
|
|
|
for_obj_type?: string;
|
|
|
|
|
for_obj_id: string;
|
|
|
|
|
qry_str?: string;
|
|
|
|
|
qry_person_id?: string | null;
|
|
|
|
|
qry_conference?: boolean | null;
|
|
|
|
|
qry_physical?: boolean | null;
|
|
|
|
|
qry_virtual?: boolean | null;
|
|
|
|
|
qry_type?: string | null;
|
|
|
|
|
enabled?: 'enabled' | 'all' | 'not_enabled';
|
|
|
|
|
hidden?: 'hidden' | 'all' | 'not_hidden';
|
|
|
|
|
view?: string;
|
|
|
|
|
limit?: number;
|
|
|
|
|
offset?: number;
|
|
|
|
|
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
|
|
|
|
try_cache?: boolean;
|
|
|
|
|
log_lvl?: number;
|
|
|
|
|
}) {
|
|
|
|
|
if (log_lvl) console.log('*** qry_ae_obj_li__event_v2() ***');
|
|
|
|
|
|
|
|
|
|
const params_json: any = { qry: { and: [] } };
|
|
|
|
|
|
|
|
|
|
if (qry_str) {
|
|
|
|
|
// Use default_qry_str for searching as requested
|
|
|
|
|
params_json.qry.and.push({ field: 'default_qry_str', op: 'like', value: qry_str });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const result_li = await get_ae_obj_li_for_obj_id_crud_v2({
|
|
|
|
|
api_cfg,
|
|
|
|
|
obj_type: 'event',
|
|
|
|
|
for_obj_type,
|
|
|
|
|
for_obj_id,
|
|
|
|
|
enabled,
|
|
|
|
|
hidden,
|
|
|
|
|
limit: (qry_person_id || qry_conference !== null || qry_physical !== null || qry_virtual !== null || qry_type !== null) ? 500 : limit,
|
|
|
|
|
offset,
|
|
|
|
|
order_by_li,
|
|
|
|
|
params_json,
|
|
|
|
|
log_lvl
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!result_li) return [];
|
|
|
|
|
|
|
|
|
|
if (try_cache) {
|
|
|
|
|
const processed_obj_li = await process_ae_obj__event_props({
|
|
|
|
|
obj_li: result_li,
|
|
|
|
|
log_lvl: log_lvl
|
|
|
|
|
});
|
|
|
|
|
await db_save_ae_obj_li__ae_obj({
|
|
|
|
|
db_instance: db_events,
|
|
|
|
|
table_name: 'event',
|
|
|
|
|
obj_li: processed_obj_li,
|
|
|
|
|
properties_to_save: properties_to_save,
|
|
|
|
|
log_lvl: log_lvl
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Client-side Filter Layer
|
|
|
|
|
return result_li.filter((ev: any) => {
|
|
|
|
|
if (qry_conference !== null && !!ev.conference !== !!qry_conference) return false;
|
|
|
|
|
if (qry_physical !== null && !!ev.physical !== !!qry_physical) return false;
|
|
|
|
|
if (qry_virtual !== null && !!ev.virtual !== !!qry_virtual) return false;
|
|
|
|
|
if (qry_type !== null && ev.type !== qry_type) return false;
|
|
|
|
|
if (qry_person_id) {
|
|
|
|
|
return (
|
|
|
|
|
ev.external_person_id === qry_person_id ||
|
|
|
|
|
ev.poc_person_id === qry_person_id ||
|
|
|
|
|
ev.poc_person_id_random === qry_person_id ||
|
|
|
|
|
ev.poc_event_person_id === qry_person_id ||
|
|
|
|
|
ev.poc_event_person_id_random === qry_person_id
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|