Fix: Fully implement recursive data fetching in Event Location
- Updated load functions to pass inc_session_li and inc_all_file_li. - Enhanced _handle_nested_loads to recursively fetch sessions and files. - Ensured consistency with Triple-ID pattern and V3 API standards.
This commit is contained in:
@@ -69,7 +69,7 @@ export async function load_ae_obj_id__event_location({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return await _handle_nested_loads(ae_promises.load__event_location_obj, { api_cfg, inc_file_li, log_lvl });
|
return await _handle_nested_loads(ae_promises.load__event_location_obj, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updated 2026-01-20 to V3
|
// Updated 2026-01-20 to V3
|
||||||
@@ -78,6 +78,8 @@ export async function load_ae_obj_li__event_location({
|
|||||||
for_obj_type = 'event',
|
for_obj_type = 'event',
|
||||||
for_obj_id,
|
for_obj_id,
|
||||||
inc_file_li = false,
|
inc_file_li = false,
|
||||||
|
inc_session_li = false,
|
||||||
|
inc_all_file_li = false,
|
||||||
enabled = 'enabled',
|
enabled = 'enabled',
|
||||||
hidden = 'not_hidden',
|
hidden = 'not_hidden',
|
||||||
limit = 100,
|
limit = 100,
|
||||||
@@ -95,6 +97,8 @@ export async function load_ae_obj_li__event_location({
|
|||||||
for_obj_type?: string;
|
for_obj_type?: string;
|
||||||
for_obj_id: string;
|
for_obj_id: string;
|
||||||
inc_file_li?: boolean;
|
inc_file_li?: boolean;
|
||||||
|
inc_session_li?: boolean;
|
||||||
|
inc_all_file_li?: boolean;
|
||||||
enabled?: 'enabled' | 'all' | 'not_enabled';
|
enabled?: 'enabled' | 'all' | 'not_enabled';
|
||||||
hidden?: 'hidden' | 'all' | 'not_hidden';
|
hidden?: 'hidden' | 'all' | 'not_hidden';
|
||||||
limit?: number;
|
limit?: number;
|
||||||
@@ -151,7 +155,7 @@ export async function load_ae_obj_li__event_location({
|
|||||||
|
|
||||||
if (ae_promises.load__event_location_obj_li) {
|
if (ae_promises.load__event_location_obj_li) {
|
||||||
for (const location of ae_promises.load__event_location_obj_li) {
|
for (const location of ae_promises.load__event_location_obj_li) {
|
||||||
await _handle_nested_loads(location, { api_cfg, inc_file_li, log_lvl });
|
await _handle_nested_loads(location, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +165,7 @@ export async function load_ae_obj_li__event_location({
|
|||||||
/**
|
/**
|
||||||
* Handle nested data loads for a single location object.
|
* Handle nested data loads for a single location object.
|
||||||
*/
|
*/
|
||||||
async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, log_lvl }: any) {
|
async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, inc_session_li, inc_all_file_li, log_lvl }: any) {
|
||||||
const current_location_id = location_obj.event_location_id_random || location_obj.event_location_id || location_obj.id;
|
const current_location_id = location_obj.event_location_id_random || location_obj.event_location_id || location_obj.id;
|
||||||
|
|
||||||
if (inc_file_li) {
|
if (inc_file_li) {
|
||||||
@@ -175,6 +179,22 @@ async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, l
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inc_session_li) {
|
||||||
|
location_obj.event_session_obj_li = await load_ae_obj_li__event_session({
|
||||||
|
api_cfg,
|
||||||
|
for_obj_type: 'event_location',
|
||||||
|
for_obj_id: current_location_id,
|
||||||
|
inc_file_li: inc_all_file_li,
|
||||||
|
inc_all_file_li: inc_all_file_li,
|
||||||
|
inc_presentation_li: true,
|
||||||
|
inc_presenter_li: true,
|
||||||
|
enabled: 'all',
|
||||||
|
hidden: 'all',
|
||||||
|
limit: 150,
|
||||||
|
log_lvl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return location_obj;
|
return location_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user