More general clean up. Making event queries easier to use and understand.
This commit is contained in:
@@ -7,7 +7,7 @@ let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-09-25
|
||||
export async function handle_load_ae_obj_id__event(
|
||||
export async function load_ae_obj_id__event(
|
||||
{
|
||||
api_cfg,
|
||||
event_id,
|
||||
@@ -30,7 +30,7 @@ export async function handle_load_ae_obj_id__event(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** handle_load_ae_obj_id__event() *** event_id=${event_id}`);
|
||||
console.log(`*** load_ae_obj_id__event() *** event_id=${event_id}`);
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function handle_load_ae_obj_id__event(
|
||||
if (event_obj_get_result) {
|
||||
if (try_cache) {
|
||||
// This is expecting a list
|
||||
handle_db_save_ae_obj_li__event({
|
||||
db_save_ae_obj_li__event({
|
||||
obj_type: 'event',
|
||||
obj_li: [event_obj_get_result]
|
||||
});
|
||||
@@ -88,7 +88,7 @@ export async function load_ae_obj_li__event(
|
||||
api_cfg: any,
|
||||
for_obj_type: string,
|
||||
for_obj_id: string,
|
||||
qry_conference?: boolean,
|
||||
qry_conference?: null|boolean,
|
||||
qry_str?: null|string,
|
||||
inc_file_li?: boolean,
|
||||
inc_location_li?: boolean,
|
||||
@@ -164,7 +164,7 @@ export async function load_ae_obj_li__event(
|
||||
.then(function (event_obj_li_get_result) {
|
||||
if (event_obj_li_get_result) {
|
||||
if (try_cache) {
|
||||
handle_db_save_ae_obj_li__event({obj_type: 'event', obj_li: event_obj_li_get_result});
|
||||
db_save_ae_obj_li__event({obj_type: 'event', obj_li: event_obj_li_get_result});
|
||||
}
|
||||
return event_obj_li_get_result;
|
||||
} else {
|
||||
@@ -182,6 +182,116 @@ export async function load_ae_obj_li__event(
|
||||
}
|
||||
|
||||
|
||||
|
||||
// The qry_ae_obj_li__event() is essentially a wrapper for the load_ae_obj_li__event() function. This should process the query strings and related before calling the load_ae_obj_li__event() function.
|
||||
// Updated 2024-10-01
|
||||
export async function qry_ae_obj_li__event(
|
||||
{
|
||||
api_cfg,
|
||||
for_obj_type = 'account',
|
||||
for_obj_id,
|
||||
qry_conference = true,
|
||||
qry_virtual = null,
|
||||
qry_physical = null,
|
||||
qry_type = null,
|
||||
qry_str = null,
|
||||
inc_file_li = false,
|
||||
inc_location_li = false,
|
||||
inc_presentation_li = false,
|
||||
inc_presenter_li = false,
|
||||
inc_session_li = false,
|
||||
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
for_obj_type: string,
|
||||
for_obj_id: string,
|
||||
qry_conference?: null|boolean,
|
||||
qry_virtual?: null|boolean,
|
||||
qry_physical?: null|boolean,
|
||||
qry_type?: null|string,
|
||||
qry_str?: null|string,
|
||||
inc_file_li?: boolean,
|
||||
inc_location_li?: boolean,
|
||||
inc_presentation_li?: boolean,
|
||||
inc_presenter_li?: boolean,
|
||||
inc_session_li?: boolean,
|
||||
order_by_li?: key_val,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** qry_ae_obj_li__event() *** for_obj_id=${for_obj_id}`);
|
||||
|
||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||
let limit: number = (params.qry__limit ?? 99); // 99
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
params_json['and_qry'] = {};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (qry_virtual) {
|
||||
params_json['and_qry']['virtual'] = qry_virtual;
|
||||
} else if (qry_virtual === false) {
|
||||
console.log('qry_virtual is false!');
|
||||
params_json['and_qry']['virtual'] = qry_virtual;
|
||||
}
|
||||
|
||||
if (qry_physical) {
|
||||
params_json['and_qry']['physical'] = qry_physical;
|
||||
} else if (qry_physical === false) {
|
||||
console.log('qry_physical is false!');
|
||||
params_json['and_qry']['physical'] = qry_physical;
|
||||
}
|
||||
|
||||
if (qry_type) {
|
||||
params_json['and_qry']['type'] = qry_type;
|
||||
}
|
||||
|
||||
if (qry_str) {
|
||||
params_json['ft_qry'] = {};
|
||||
params_json['ft_qry']['default_qry_str'] = qry_str;
|
||||
params_json['ft_qry']['location_address_json_ext'] = qry_str;
|
||||
params_json['ft_qry']['contact_li_json_ext'] = qry_str;
|
||||
}
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('params_json:', params_json);
|
||||
}
|
||||
|
||||
ae_promises.qry__event_obj_li = await load_ae_obj_li__event({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: for_obj_type,
|
||||
for_obj_id: for_obj_id,
|
||||
qry_conference: qry_conference,
|
||||
qry_str: qry_str,
|
||||
inc_file_li: inc_file_li,
|
||||
inc_location_li: inc_location_li,
|
||||
inc_presentation_li: inc_presentation_li,
|
||||
inc_presenter_li: inc_presenter_li,
|
||||
inc_session_li: inc_session_li,
|
||||
order_by_li: order_by_li,
|
||||
params: params,
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
return ae_promises.qry__event_obj_li;
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-25
|
||||
export async function create_ae_obj__event(
|
||||
{
|
||||
@@ -214,7 +324,7 @@ export async function create_ae_obj__event(
|
||||
})
|
||||
.then(function (event_obj_create_result) {
|
||||
if (event_obj_create_result) {
|
||||
handle_db_save_ae_obj_li__event(
|
||||
db_save_ae_obj_li__event(
|
||||
{
|
||||
obj_type: 'event',
|
||||
obj_li: [event_obj_create_result]
|
||||
@@ -272,7 +382,7 @@ export async function update_ae_obj__event(
|
||||
.then(function (event_obj_update_result) {
|
||||
if (event_obj_update_result) {
|
||||
if (try_cache) {
|
||||
handle_db_save_ae_obj_li__event({
|
||||
db_save_ae_obj_li__event({
|
||||
obj_type: 'event', obj_li: [event_obj_update_result]
|
||||
});
|
||||
}
|
||||
@@ -295,7 +405,7 @@ export async function update_ae_obj__event(
|
||||
|
||||
|
||||
// This function will loop through the event_obj_li and save each one to the DB.
|
||||
export function handle_db_save_ae_obj_li__event(
|
||||
export function db_save_ae_obj_li__event(
|
||||
{
|
||||
obj_type,
|
||||
obj_li,
|
||||
@@ -307,7 +417,7 @@ export function handle_db_save_ae_obj_li__event(
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** handle_db_save_ae_obj_li__event() ***`);
|
||||
console.log(`*** db_save_ae_obj_li__event() ***`);
|
||||
}
|
||||
|
||||
if (obj_li && obj_li.length) {
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
// This file is used to export all the functions that are used for Aether Events related functions.
|
||||
|
||||
import {
|
||||
handle_load_ae_obj_id__event,
|
||||
load_ae_obj_li__event,
|
||||
create_ae_obj__event,
|
||||
update_ae_obj__event,
|
||||
handle_db_save_ae_obj_li__event,
|
||||
sync_config__event_pres_mgmt,
|
||||
} from "$lib/ae_events__event";
|
||||
// Import all the functions from this library:
|
||||
import * as events from "$lib/ae_events__event";
|
||||
|
||||
import {
|
||||
handle_load_ae_obj_id__event_file,
|
||||
@@ -77,12 +71,12 @@ import {
|
||||
|
||||
|
||||
let export_obj = {
|
||||
handle_load_ae_obj_id__event: handle_load_ae_obj_id__event,
|
||||
load_ae_obj_li__event: load_ae_obj_li__event,
|
||||
create_ae_obj__event: create_ae_obj__event,
|
||||
update_ae_obj__event: update_ae_obj__event,
|
||||
handle_db_save_ae_obj_li__event: handle_db_save_ae_obj_li__event,
|
||||
sync_config__event_pres_mgmt: sync_config__event_pres_mgmt,
|
||||
handle_load_ae_obj_id__event: events.load_ae_obj_id__event,
|
||||
load_ae_obj_li__event: events.load_ae_obj_li__event,
|
||||
create_ae_obj__event: events.create_ae_obj__event,
|
||||
update_ae_obj__event: events.update_ae_obj__event,
|
||||
handle_db_save_ae_obj_li__event: events.db_save_ae_obj_li__event,
|
||||
sync_config__event_pres_mgmt: events.sync_config__event_pres_mgmt,
|
||||
|
||||
handle_load_ae_obj_id__event_file: handle_load_ae_obj_id__event_file,
|
||||
handle_load_ae_obj_li__event_file: handle_load_ae_obj_li__event_file,
|
||||
|
||||
@@ -53,10 +53,15 @@ let idaa_local_data_struct: key_val = {
|
||||
},
|
||||
|
||||
recovery_meetings: {
|
||||
enabled: 'enabled', // all, disabled, enabled
|
||||
hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
limit: 150,
|
||||
offset: 0,
|
||||
qry__enabled: 'enabled', // all, disabled, enabled
|
||||
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
qry__limit: 150,
|
||||
qry__offset: 0,
|
||||
|
||||
qry__fulltext_str: null,
|
||||
qry__physical: null,
|
||||
qry__type: null,
|
||||
qry__virtual: null,
|
||||
},
|
||||
};
|
||||
// console.log(`AE Stores - App IDAA Local Storage Data:`, idaa_local_data_struct);
|
||||
@@ -87,7 +92,7 @@ let idaa_session_data_struct: key_val = {
|
||||
|
||||
recovery_meetings: {
|
||||
qry__status: null,
|
||||
qry__fulltext_str: null,
|
||||
// qry__fulltext_str: null,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import { onMount } from 'svelte';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
// import { api, Element_obj_tbl_row } from 'aether_npm_lib';
|
||||
import Element_obj_tbl_row from '$lib/element_obj_tbl_row.svelte';
|
||||
import { post_object } from '$lib/api_post_object';
|
||||
import { post_object } from '$lib/ae_api/api_post_object';
|
||||
|
||||
// *** Import Aether core components
|
||||
// import Element_obj_tbl_row from './element_obj_tbl_row.svelte';
|
||||
|
||||
Reference in New Issue
Block a user