Export now works for Sponsors, Speakers, and Leads

This commit is contained in:
Scott Idem
2024-04-23 17:10:24 -04:00
parent ca04e9739f
commit 2aff1aadbe
3 changed files with 51 additions and 4 deletions

View File

@@ -283,10 +283,53 @@ async function handle_update_ae_obj_id_crud(
}
async function handle_download_export__obj_type(
{
api_cfg,
get_obj_type, // The type of object to return: event_badge, event_presenter, sponsorship, etc.
for_obj_type, // Usually for an account, event, event_exhibit, or sponsorship_cfg
for_obj_id, // The ID of the object
file_type='CSV', // 'CSV' or 'Excel'
return_file=true,
filename='no_filename.csv',
auto_download=false,
params={}, // key value object is expected
log_lvl=0
} : {
api_cfg: any,
get_obj_type: string,
for_obj_type: string,
for_obj_id: string,
file_type?: string,
return_file?: boolean,
filename?: string,
auto_download?: boolean,
params?: key_val,
log_lvl?: number
}
) {
console.log('*** stores_event_api.js: get_sponsorship_export() ***');
const endpoint = `/v2/crud/${get_obj_type}/list`;
params['for_obj_type'] = for_obj_type;
params['for_obj_id'] = for_obj_id;
if (file_type == 'CSV' || file_type == 'Excel') {
params['file_type'] = file_type;
}
params['return_file'] = true;
ae_promises.download__sponsorship_export_file = await api.get_object({api_cfg: api_cfg, endpoint: endpoint, params: params, return_blob: return_file, filename: filename, auto_download: auto_download, log_lvl: log_lvl});
console.log('ae_promises.download__sponsorship_export_file:', ae_promises.download__sponsorship_export_file);
return ae_promises.download__sponsorship_export_file;
}
let export_obj = {
handle_load_ae_obj_id__site_domain: handle_load_ae_obj_id__site_domain,
handle_load_ae_obj_code__data_store: handle_load_ae_obj_code__data_store,
handle_update_ae_obj_id_crud: handle_update_ae_obj_id_crud,
handle_download_export__obj_type: handle_download_export__obj_type,
};
export let core_func = export_obj;