Wrapping up for the night.
This commit is contained in:
@@ -11,7 +11,7 @@ import { load_ae_obj_li__event_session } from './ae_events__event_session';
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-10-16
|
||||
// Updated 2025-05-22
|
||||
export async function load_ae_obj_id__event(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -177,7 +177,7 @@ export async function load_ae_obj_id__event(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-11-20
|
||||
// Updated 2025-05-22
|
||||
export async function load_ae_obj_li__event(
|
||||
{
|
||||
api_cfg,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
|
||||
import { db_events } from "$lib/ae_events/db_events";
|
||||
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file";
|
||||
import { load_ae_obj_li__event_presenter } from "$lib/ae_events/ae_events__event_presenter";
|
||||
@@ -8,7 +9,7 @@ import { load_ae_obj_li__event_presenter } from "$lib/ae_events/ae_events__event
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-10-08
|
||||
// Updated 2025-05-22
|
||||
export async function load_ae_obj_id__event_presentation(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -26,7 +27,9 @@ export async function load_ae_obj_id__event_presentation(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`);
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`);
|
||||
}
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -39,15 +42,38 @@ export async function load_ae_obj_id__event_presentation(
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_presentation_obj_get_result) {
|
||||
.then(async function (event_presentation_obj_get_result) {
|
||||
if (event_presentation_obj_get_result) {
|
||||
if (try_cache) {
|
||||
// This is expecting a list
|
||||
db_save_ae_obj_li__event_presentation({
|
||||
obj_type: 'event_presentation',
|
||||
obj_li: [event_presentation_obj_get_result]
|
||||
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_presentation_props({
|
||||
obj_li: [event_presentation_obj_get_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presentations',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// // This is expecting a list
|
||||
// db_save_ae_obj_li__event_presentation({
|
||||
// obj_type: 'event_presentation',
|
||||
// obj_li: [event_presentation_obj_get_result]
|
||||
|
||||
// });
|
||||
}
|
||||
return event_presentation_obj_get_result;
|
||||
} else {
|
||||
@@ -116,7 +142,7 @@ export async function load_ae_obj_id__event_presentation(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-10-08
|
||||
// Updated 2025-05-22
|
||||
export async function load_ae_obj_li__event_presentation(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -140,7 +166,9 @@ export async function load_ae_obj_li__event_presentation(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__event_presentation() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__event_presentation() *** for_obj_type=${for_obj_type} 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
|
||||
@@ -151,13 +179,14 @@ export async function load_ae_obj_li__event_presentation(
|
||||
|
||||
// console('params_json:', params_json);
|
||||
|
||||
ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
// ae_promises.load__event_presentation_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event_presentation',
|
||||
for_obj_type: for_obj_type,
|
||||
for_obj_id: for_obj_id,
|
||||
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
||||
use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: order_by_li,
|
||||
@@ -167,12 +196,35 @@ export async function load_ae_obj_li__event_presentation(
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_presentation_obj_li_get_result) {
|
||||
.then(async function (event_presentation_obj_li_get_result) {
|
||||
if (event_presentation_obj_li_get_result) {
|
||||
if (try_cache) {
|
||||
db_save_ae_obj_li__event_presentation({
|
||||
obj_type: 'event_presentation', obj_li: event_presentation_obj_li_get_result
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_presentation_props({
|
||||
obj_li: event_presentation_obj_li_get_result,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presentations',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// db_save_ae_obj_li__event_presentation({
|
||||
// obj_type: 'event_presentation', obj_li: event_presentation_obj_li_get_result
|
||||
// });
|
||||
}
|
||||
return event_presentation_obj_li_get_result;
|
||||
} else {
|
||||
@@ -253,7 +305,7 @@ export async function load_ae_obj_li__event_presentation(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-06-24
|
||||
// Updated 2025-05-22
|
||||
export async function create_ae_obj__event_presentation(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -290,14 +342,37 @@ export async function create_ae_obj__event_presentation(
|
||||
return_obj: true,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_presentation_obj_create_result) {
|
||||
.then(async function (event_presentation_obj_create_result) {
|
||||
if (event_presentation_obj_create_result) {
|
||||
if (try_cache) {
|
||||
db_save_ae_obj_li__event_presentation(
|
||||
{
|
||||
obj_type: 'event_presentation',
|
||||
obj_li: [event_presentation_obj_create_result]
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_presentation_props({
|
||||
obj_li: [event_presentation_obj_create_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presentations',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// db_save_ae_obj_li__event_presentation(
|
||||
// {
|
||||
// obj_type: 'event_presentation',
|
||||
// obj_li: [event_presentation_obj_create_result]
|
||||
// });
|
||||
}
|
||||
return event_presentation_obj_create_result;
|
||||
} else {
|
||||
@@ -317,7 +392,7 @@ export async function create_ae_obj__event_presentation(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-11-08
|
||||
// Updated 2025-05-22
|
||||
export async function delete_ae_obj_id__event_presentation(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -348,14 +423,6 @@ export async function delete_ae_obj_id__event_presentation(
|
||||
method: method,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_presentation_obj_delete_result) {
|
||||
// if (event_presentation_obj_delete_result) {
|
||||
// // db_save_ae_obj_li__event_presentation({obj_type: 'event_presentation', obj_li: [event_presentation_obj_delete_result]});
|
||||
// return event_presentation_obj_delete_result;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
@@ -376,7 +443,7 @@ export async function delete_ae_obj_id__event_presentation(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-25
|
||||
// Updated 2025-05-22
|
||||
export async function update_ae_obj__event_presentation(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -407,14 +474,37 @@ export async function update_ae_obj__event_presentation(
|
||||
return_obj: true,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_presentation_obj_update_result) {
|
||||
.then(async function (event_presentation_obj_update_result) {
|
||||
if (event_presentation_obj_update_result) {
|
||||
if (try_cache) {
|
||||
db_save_ae_obj_li__event_presentation({
|
||||
obj_type: 'event_presentation',
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_presentation_props({
|
||||
obj_li: [event_presentation_obj_update_result],
|
||||
log_lvl: log_lvl
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presentations',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// db_save_ae_obj_li__event_presentation({
|
||||
// obj_type: 'event_presentation',
|
||||
// obj_li: [event_presentation_obj_update_result],
|
||||
// log_lvl: log_lvl
|
||||
// });
|
||||
}
|
||||
return event_presentation_obj_update_result;
|
||||
} else {
|
||||
@@ -521,3 +611,134 @@ export function db_save_ae_obj_li__event_presentation(
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Updated 2025-05-22
|
||||
export const properties_to_save = [
|
||||
'id',
|
||||
'event_presentation_id',
|
||||
'event_presentation_id_random',
|
||||
|
||||
'external_id',
|
||||
'code',
|
||||
|
||||
'for_type',
|
||||
'for_id',
|
||||
'for_id_random',
|
||||
|
||||
'type_code',
|
||||
|
||||
'event_id',
|
||||
'event_id_random',
|
||||
'event_session_id',
|
||||
'event_session_id_random',
|
||||
'event_abstract_id',
|
||||
'event_abstract_id_random',
|
||||
|
||||
'abstract_code',
|
||||
|
||||
'name',
|
||||
'description',
|
||||
|
||||
'start_datetime',
|
||||
'end_datetime',
|
||||
|
||||
'passcode',
|
||||
|
||||
'hide_event_launcher',
|
||||
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
|
||||
// From SQL view
|
||||
'event_session_code',
|
||||
'event_session_name',
|
||||
|
||||
// Add more fields here if your DB save logic uses them
|
||||
];
|
||||
|
||||
|
||||
// Updated 2025-05-22
|
||||
export async function process_ae_obj__event_presentation_props({
|
||||
obj_li,
|
||||
log_lvl = 0,
|
||||
}: {
|
||||
obj_li: any[];
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** process_ae_obj__event_presentation_props() ***`, obj_li);
|
||||
}
|
||||
|
||||
if (!obj_li || obj_li.length === 0) {
|
||||
if (log_lvl) {
|
||||
console.log('No objects to process.');
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
const processed_obj_li = [];
|
||||
|
||||
for (const obj of obj_li) {
|
||||
if (log_lvl) {
|
||||
console.log(`Processing ae_obj event_presentation:`, obj);
|
||||
}
|
||||
|
||||
let processed_obj = {
|
||||
id: obj.event_presentation_id_random,
|
||||
event_presentation_id: obj.event_presentation_id_random,
|
||||
event_presentation_id_random: obj.event_presentation_id_random,
|
||||
|
||||
external_id: obj.external_id,
|
||||
code: obj.code,
|
||||
|
||||
for_type: obj.for_type,
|
||||
for_id: obj.for_id_random,
|
||||
for_id_random: obj.for_id_random,
|
||||
|
||||
type_code: obj.type_code,
|
||||
|
||||
event_id: obj.event_id_random,
|
||||
event_id_random: obj.event_id_random,
|
||||
event_session_id: obj.event_session_id_random,
|
||||
event_session_id_random: obj.event_session_id_random,
|
||||
event_abstract_id: obj.event_abstract_id_random,
|
||||
event_abstract_id_random: obj.event_abstract_id_random,
|
||||
|
||||
abstract_code: obj.abstract_code,
|
||||
|
||||
name: obj.name,
|
||||
description: obj.description,
|
||||
|
||||
start_datetime: obj.start_datetime,
|
||||
end_datetime: obj.end_datetime,
|
||||
|
||||
passcode: obj.passcode,
|
||||
|
||||
hide_event_launcher: obj.hide_event_launcher,
|
||||
|
||||
enable: obj.enable,
|
||||
hide: obj.hide,
|
||||
priority: obj.priority,
|
||||
sort: obj.sort,
|
||||
group: obj.group,
|
||||
notes: obj.notes,
|
||||
created_on: obj.created_on,
|
||||
updated_on: obj.updated_on,
|
||||
|
||||
// From SQL view
|
||||
event_session_code: obj.event_session_code,
|
||||
event_session_name: obj.event_session_name,
|
||||
};
|
||||
|
||||
processed_obj_li.push(processed_obj);
|
||||
}
|
||||
|
||||
return processed_obj_li;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_save_ae_obj_li__ae_obj } from "$lib/ae_core/core__idb_dexie";
|
||||
import { db_events } from "$lib/ae_events/db_events";
|
||||
|
||||
import { load_ae_obj_li__event_file } from "$lib/ae_events/ae_events__event_file";
|
||||
@@ -9,7 +10,7 @@ import { load_ae_obj_li__event_presentation } from "$lib/ae_events/ae_events__ev
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-08-09
|
||||
// Updated 2025-05-22
|
||||
export async function load_ae_obj_id__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -29,7 +30,9 @@ export async function load_ae_obj_id__event_session(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_id__event_session() *** event_session_id=${event_session_id}`);
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__event_session() *** event_session_id=${event_session_id}`);
|
||||
}
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -43,14 +46,37 @@ export async function load_ae_obj_id__event_session(
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_session_obj_get_result) {
|
||||
.then(async function (event_session_obj_get_result) {
|
||||
if (event_session_obj_get_result) {
|
||||
if (try_cache) {
|
||||
// This is expecting a list
|
||||
db_save_ae_obj_li__event_session({
|
||||
obj_type: 'event_session',
|
||||
obj_li: [event_session_obj_get_result]
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_session_props({
|
||||
obj_li: [event_session_obj_get_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'sessions',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// // This is expecting a list
|
||||
// db_save_ae_obj_li__event_session({
|
||||
// obj_type: 'event_session',
|
||||
// obj_li: [event_session_obj_get_result]
|
||||
// });
|
||||
}
|
||||
return event_session_obj_get_result;
|
||||
} else {
|
||||
@@ -138,7 +164,7 @@ export async function load_ae_obj_id__event_session(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-08-09
|
||||
// Updated 2025-05-22
|
||||
export async function load_ae_obj_li__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -164,7 +190,9 @@ export async function load_ae_obj_li__event_session(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__event_session() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__event_session() *** for_obj_type=${for_obj_type} 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
|
||||
@@ -175,13 +203,14 @@ export async function load_ae_obj_li__event_session(
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
|
||||
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
// ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event_session',
|
||||
for_obj_type: for_obj_type,
|
||||
for_obj_id: for_obj_id,
|
||||
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
||||
use_alt_tbl: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
// use_alt_mdl: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: order_by_li,
|
||||
@@ -191,13 +220,36 @@ export async function load_ae_obj_li__event_session(
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_session_obj_li_get_result) {
|
||||
.then(async function (event_session_obj_li_get_result) {
|
||||
if (event_session_obj_li_get_result) {
|
||||
if (try_cache) {
|
||||
db_save_ae_obj_li__event_session({
|
||||
obj_type: 'event_session',
|
||||
obj_li: event_session_obj_li_get_result
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_session_props({
|
||||
obj_li: event_session_obj_li_get_result,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'sessions',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// db_save_ae_obj_li__event_session({
|
||||
// obj_type: 'event_session',
|
||||
// obj_li: event_session_obj_li_get_result
|
||||
// });
|
||||
}
|
||||
return event_session_obj_li_get_result;
|
||||
} else {
|
||||
@@ -288,7 +340,7 @@ export async function load_ae_obj_li__event_session(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-25
|
||||
// Updated 2025-05-22
|
||||
export async function create_ae_obj__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -322,14 +374,37 @@ export async function create_ae_obj__event_session(
|
||||
return_obj: true,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_session_obj_create_result) {
|
||||
.then(async function (event_session_obj_create_result) {
|
||||
if (event_session_obj_create_result) {
|
||||
if (try_cache) {
|
||||
db_save_ae_obj_li__event_session(
|
||||
{
|
||||
obj_type: 'event_session',
|
||||
obj_li: [event_session_obj_create_result]
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_session_props({
|
||||
obj_li: [event_session_obj_create_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'sessions',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// db_save_ae_obj_li__event_session(
|
||||
// {
|
||||
// obj_type: 'event_session',
|
||||
// obj_li: [event_session_obj_create_result]
|
||||
// });
|
||||
}
|
||||
return event_session_obj_create_result;
|
||||
} else {
|
||||
@@ -349,7 +424,7 @@ export async function create_ae_obj__event_session(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-11-08
|
||||
// Updated 2025-05-22
|
||||
export async function delete_ae_obj_id__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -380,14 +455,6 @@ export async function delete_ae_obj_id__event_session(
|
||||
method: method,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_session_obj_delete_result) {
|
||||
// if (event_session_obj_delete_result) {
|
||||
// // db_save_ae_obj_li__event_session({obj_type: 'event_session', obj_li: [event_session_obj_delete_result]});
|
||||
// return event_session_obj_delete_result;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
@@ -408,7 +475,7 @@ export async function delete_ae_obj_id__event_session(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-13
|
||||
// Updated 2025-05-22
|
||||
export async function update_ae_obj__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -440,12 +507,35 @@ export async function update_ae_obj__event_session(
|
||||
return_obj: true,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (event_session_obj_update_result) {
|
||||
.then(async function (event_session_obj_update_result) {
|
||||
if (event_session_obj_update_result) {
|
||||
if (try_cache) {
|
||||
db_save_ae_obj_li__event_session({
|
||||
obj_type: 'event_session', obj_li: [event_session_obj_update_result]
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__event_session_props({
|
||||
obj_li: [event_session_obj_update_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'sessions',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
|
||||
// db_save_ae_obj_li__event_session({
|
||||
// obj_type: 'event_session', obj_li: [event_session_obj_update_result]
|
||||
// });
|
||||
}
|
||||
return event_session_obj_update_result;
|
||||
} else {
|
||||
@@ -466,7 +556,7 @@ export async function update_ae_obj__event_session(
|
||||
|
||||
|
||||
// This new function is using CRUD v2. This should allow for more flexibility in the queries.
|
||||
// Updated 2024-08-14
|
||||
// Updated 2025-05-22
|
||||
export async function qry__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -636,7 +726,7 @@ export async function qry__event_session(
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-13
|
||||
// Updated 2025-05-22
|
||||
export async function search__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
@@ -742,13 +832,14 @@ export async function search__event_session(
|
||||
|
||||
let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
|
||||
|
||||
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
// ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
ae_promises.load__event_session_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event_session',
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
use_alt_table: true, // NOTE: We want to use the alt table for session searching
|
||||
use_alt_base: false,
|
||||
use_alt_tbl: true, // NOTE: We want to use the alt table for session searching
|
||||
// use_alt_mdl: false,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: order_by_li,
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function load({ params, parent }) { // route
|
||||
if (log_lvl) {
|
||||
console.log(`event_presentation_obj_li = `, event_presentation_obj_li);
|
||||
}
|
||||
for (let index = 0; index < event_presentation_obj_li.length; index++) {
|
||||
for (let index = 0; index < event_presentation_obj_li?.length; index++) {
|
||||
let event_presentation_obj = event_presentation_obj_li[index];
|
||||
let event_presentation_id = event_presentation_obj.event_presentation_id_random;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user