General clean up and renaming of functions.

This commit is contained in:
Scott Idem
2024-08-19 14:53:28 -04:00
parent 6aa499c79b
commit 75b0e53114
6 changed files with 17 additions and 116 deletions

View File

@@ -36,7 +36,7 @@ export async function handle_load_ae_obj_id__event_file(
.then(function (event_file_obj_get_result) {
if (event_file_obj_get_result) {
// This is expecting a list
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_get_result]});
db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_get_result]});
return event_file_obj_get_result;
} else {
console.log('No results returned.');
@@ -106,7 +106,7 @@ export async function handle_load_ae_obj_li__event_file(
.then(function (event_file_obj_li_get_result) {
if (event_file_obj_li_get_result) {
if (try_cache) {
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
}
return event_file_obj_li_get_result;
} else {
@@ -252,9 +252,9 @@ export async function handle_update_ae_obj__event_file(
})
.then(function (event_file_obj_update_result) {
if (event_file_obj_update_result) {
// handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_update_result]});
// db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_update_result]});
// Very important: The results returned from the API does not include fields from the DB views. It is the actual table fields only.
handle_db_update_ae_obj_id__event_file({obj_type: 'event_file', obj_id: event_file_id, data_kv: event_file_obj_update_result});
db_update_ae_obj_id__event_file({obj_type: 'event_file', obj_id: event_file_id, data_kv: event_file_obj_update_result});
return event_file_obj_update_result;
} else {
return null;
@@ -274,7 +274,7 @@ export async function handle_update_ae_obj__event_file(
// Updated 2024-07-12
export async function handle_search__event_file(
export async function search__event_file(
{
api_cfg,
event_id,
@@ -304,7 +304,7 @@ export async function handle_search__event_file(
}
) {
if (log_lvl) {
console.log(`*** handle_search__event_file() *** event_id=${event_id}`);
console.log(`*** search__event_file() *** event_id=${event_id}`);
}
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
@@ -379,7 +379,7 @@ export async function handle_search__event_file(
})
.then(function (event_file_obj_li_get_result) {
if (event_file_obj_li_get_result) {
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
return event_file_obj_li_get_result;
} else {
return [];
@@ -399,7 +399,7 @@ export async function handle_search__event_file(
// This function will loop through the event_file_obj_li and save each one to the DB.
export function handle_db_save_ae_obj_li__event_file(
export function db_save_ae_obj_li__event_file(
{
obj_type,
obj_li,
@@ -411,7 +411,7 @@ export function handle_db_save_ae_obj_li__event_file(
}
) {
if (log_lvl) {
console.log(`*** handle_db_save_ae_obj_li__event_file() ***`);
console.log(`*** db_save_ae_obj_li__event_file() ***`);
}
if (obj_li && obj_li.length) {
@@ -494,7 +494,7 @@ export function handle_db_save_ae_obj_li__event_file(
}
export function handle_db_update_ae_obj_id__event_file(
export function db_update_ae_obj_id__event_file(
{
obj_type,
obj_id,
@@ -505,7 +505,7 @@ export function handle_db_update_ae_obj_id__event_file(
data_kv: key_val
}
) {
console.log(`*** handle_db_update_ae_obj_id__event_file() ***`);
console.log(`*** db_update_ae_obj_id__event_file() ***`);
if (obj_id) {
console.log(`ae_obj ${obj_type}:`, obj_id);