General clean up. Improved event search and listing for IDAA.
This commit is contained in:
@@ -337,6 +337,7 @@ async function handle_download_export__obj_type(
|
||||
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
|
||||
exp_alt = null, // Export name (idaa, other, not 'default')
|
||||
file_type='CSV', // 'CSV' or 'Excel'
|
||||
return_file=true,
|
||||
filename='no_filename.csv',
|
||||
@@ -349,6 +350,7 @@ async function handle_download_export__obj_type(
|
||||
get_obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_id: string,
|
||||
exp_alt?: null|string,
|
||||
file_type?: string,
|
||||
return_file?: boolean,
|
||||
filename?: string,
|
||||
@@ -373,6 +375,10 @@ async function handle_download_export__obj_type(
|
||||
|
||||
params['mdl_alt'] = 'out';
|
||||
|
||||
if (exp_alt) {
|
||||
params['exp_alt'] = exp_alt;
|
||||
}
|
||||
|
||||
// let clean_filename = filename.replace(/[^a-z0-9]/gi, '_');
|
||||
// let clean_filename = filename.replace(/[^a-z0-9\[\]-]/gi, '_');
|
||||
let clean_filename = filename.replace(/[^a-zA-Z0-9\[\]-_.]/gi, '_');
|
||||
@@ -382,7 +388,7 @@ async function handle_download_export__obj_type(
|
||||
params['limit'] = limit;
|
||||
}
|
||||
|
||||
ae_promises.download__sponsorship_export_file = await api.get_object({
|
||||
ae_promises.download__export_file = await api.get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
params: params,
|
||||
@@ -393,8 +399,8 @@ async function handle_download_export__obj_type(
|
||||
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;
|
||||
console.log('ae_promises.download__export_file:', ae_promises.download__export_file);
|
||||
return ae_promises.download__export_file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ export async function load_ae_obj_li__event(
|
||||
if (qry_conference) {
|
||||
params_json['and_qry']['conference'] = qry_conference;
|
||||
} else if (qry_conference === false) {
|
||||
console.log('qry_conference is false!');
|
||||
params_json['and_qry']['conference'] = qry_conference;
|
||||
}
|
||||
|
||||
|
||||
@@ -384,7 +384,7 @@ export async function qry__post(
|
||||
params_json['qry'].push(qry_param);
|
||||
}
|
||||
|
||||
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
|
||||
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'};
|
||||
|
||||
ae_promises.load__post_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
|
||||
api_cfg: api_cfg,
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function load_ae_obj_li__post_comment(
|
||||
api_cfg,
|
||||
for_obj_type = 'post',
|
||||
for_obj_id,
|
||||
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
101
src/lib/api.ts
101
src/lib/api.ts
@@ -5,15 +5,15 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
|
||||
import { delete_object } from './api_delete_object'; // Exported at the end of this file
|
||||
import { get_object } from './api_get_object'; // Exported at the end of this file
|
||||
import { patch_object } from './api_patch_object'; // Exported at the end of this file
|
||||
import { post_object } from './api_post_object'; // Exported at the end of this file
|
||||
import { delete_object } from './ae_api/api_delete_object'; // Exported at the end of this file
|
||||
import { get_object } from './ae_api/api_get_object'; // Exported at the end of this file
|
||||
import { patch_object } from './ae_api/api_patch_object'; // Exported at the end of this file
|
||||
import { post_object } from './ae_api/api_post_object'; // Exported at the end of this file
|
||||
|
||||
|
||||
import { get_ae_obj_id_crud } from '$lib/api_get__crud_obj_id';
|
||||
import { get_ae_obj_li_for_obj_id_crud } from '$lib/api_get__crud_obj_li_v1';
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/api_get__crud_obj_li_v2';
|
||||
import { get_ae_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_id';
|
||||
import { get_ae_obj_li_for_obj_id_crud } from '$lib/ae_api/api_get__crud_obj_li_v1';
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/ae_api/api_get__crud_obj_li_v2';
|
||||
|
||||
|
||||
// This new function has not been tested yet!!!
|
||||
@@ -308,16 +308,16 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
obj_id,
|
||||
field_name,
|
||||
field_value,
|
||||
fields={},
|
||||
fields = {},
|
||||
key,
|
||||
jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
data={},
|
||||
return_obj=false,
|
||||
obj_v_name='',
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
jwt = null,
|
||||
headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
return_obj = false,
|
||||
obj_v_name = '',
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
@@ -326,7 +326,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
field_value?: any,
|
||||
fields?: key_val,
|
||||
key: string,
|
||||
jwt?: string,
|
||||
jwt?: null|string,
|
||||
headers?: key_val,
|
||||
params?: key_val,
|
||||
data?: null|key_val,
|
||||
@@ -340,8 +340,11 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
console.log('*** update_ae_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
data['super_key'] = key;
|
||||
data['jwt'] = jwt;
|
||||
if (!data) {
|
||||
data = {};
|
||||
data['super_key'] = key;
|
||||
data['jwt'] = jwt;
|
||||
}
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// This obj_v_name is the view name to use when returning data. Do not prefix it with v_. This is checked and done automatically by the API.
|
||||
@@ -516,19 +519,19 @@ export let delete_ae_obj_id_crud = async function delete_ae_obj_id_crud(
|
||||
obj_type,
|
||||
obj_id,
|
||||
key,
|
||||
jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
data={},
|
||||
method='delete', // 'delete', 'disable', 'hide'
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
jwt = null,
|
||||
headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
method = 'delete', // 'delete', 'disable', 'hide'
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
} : {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
obj_id: string,
|
||||
key: string,
|
||||
jwt?: string,
|
||||
jwt?: null|string,
|
||||
headers?: any,
|
||||
params?: any,
|
||||
data?: any,
|
||||
@@ -795,40 +798,42 @@ export let send_email = async function send_email(
|
||||
{
|
||||
api_cfg,
|
||||
from_email,
|
||||
from_name='',
|
||||
from_name = '',
|
||||
to_email,
|
||||
to_name='',
|
||||
cc_email=null,
|
||||
cc_name=null,
|
||||
bcc_email=null,
|
||||
bcc_name=null,
|
||||
to_name = '',
|
||||
cc_email = null,
|
||||
cc_name = null,
|
||||
bcc_email = null,
|
||||
bcc_name = null,
|
||||
subject,
|
||||
body_html,
|
||||
body_text=null,
|
||||
headers={},
|
||||
params={},
|
||||
data={},
|
||||
return_obj=false,
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
body_text = null,
|
||||
// headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
return_obj = false,
|
||||
return_meta = false,
|
||||
test = true,
|
||||
log_lvl = 0
|
||||
} : {
|
||||
api_cfg: any,
|
||||
from_email: string,
|
||||
from_name?: string,
|
||||
to_email: string,
|
||||
to_name?: string,
|
||||
cc_email?: string,
|
||||
cc_name?: string,
|
||||
bcc_email?: string,
|
||||
bcc_name?: string,
|
||||
cc_email?: null|string,
|
||||
cc_name?: null|string,
|
||||
bcc_email?: null|string,
|
||||
bcc_name?: null|string,
|
||||
subject: string,
|
||||
body_html: string,
|
||||
body_text?: string,
|
||||
headers?: key_val,
|
||||
body_text?: null|string,
|
||||
// headers?: key_val,
|
||||
params?: key_val,
|
||||
data?: key_val,
|
||||
return_obj?: boolean,
|
||||
return_meta?: boolean,
|
||||
test?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
@@ -861,6 +866,10 @@ export let send_email = async function send_email(
|
||||
params['return_obj'] = true;
|
||||
}
|
||||
|
||||
if (test) {
|
||||
params['test'] = true;
|
||||
}
|
||||
|
||||
let send_email_post_promise = await api.post_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
|
||||
Reference in New Issue
Block a user