Another round of lots of updates to fix little bugs here there and everywhere.

This commit is contained in:
Scott Idem
2025-11-13 20:03:51 -05:00
parent 13869b40bd
commit 7cd59bfaac
9 changed files with 26 additions and 18 deletions

View File

@@ -4,6 +4,14 @@ This is a list of tasks to be completed before the next event/show/conference.
---
## Big Picture Goals
* Able to cache data and mostly work offline.
* The new Events Launcher must be able to work offline and query the API for changes to data.
* The new Events Launcher must be able to run inside an Electron app and have access to local files and commands. This includes loading a special library that only works in Electron.
---
## Codebase Standardization
### 1. Naming Conventions

View File

@@ -14,7 +14,7 @@ export let get_object = async function get_object(
params = {},
data = {},
timeout = 60000,
// return_meta = false,
return_meta = false,
return_blob = false,
filename = '',
auto_download = false,
@@ -30,7 +30,7 @@ export let get_object = async function get_object(
params?: any,
data?: any,
timeout?: number,
// return_meta?: boolean,
return_meta?: boolean,
return_blob?: boolean,
filename?: null | string,
auto_download?: boolean,
@@ -105,7 +105,7 @@ export let get_object = async function get_object(
for (let attempt = 1; attempt <= retry_count; attempt++) {
try {
const response = await fetch_method(url.toString(), fetchOptions)
.catch(function (error) {
.catch(function (error: any) {
console.log('API GET Object *fetch* request was aborted or failed in an unexpected way.', error);
});
clearTimeout(timeoutId);

View File

@@ -267,8 +267,8 @@ export async function qry__activity_log(
qry_str?: string,
qry_files?: null|boolean,
qry_start_datetime?: null|string, // Greater than this datetime
enabled?: string, // all, disabled, enabled
hidden?: string, // all, hidden, not_hidden
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden
limit?: number,
offset?: number,
params?: any,
@@ -323,7 +323,7 @@ export async function qry__activity_log(
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: { [key: string]: "ASC" | "DESC" }[] = [{'priority': 'DESC'}, {'sort': 'DESC'}, {'start_datetime': 'ASC'}, {'name': 'ASC'}, {'updated_on': 'DESC'}, {'created_on': 'DESC'}];
ae_promises.load__activity_log_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,

View File

@@ -68,8 +68,8 @@ export async function db_save_ae_obj_li__ae_obj<T extends Record<string, any>>({
const db_table: Table<T> = db_instance.table(table_name);
if (!db_table) {
const error_msg = `Table not found in Dexie instance: ${table_name}`;
console.error(errorMsg);
throw new Error(errorMsg);
console.error(error_msg);
throw new Error(error_msg);
}
const data_to_save = obj_li

View File

@@ -99,7 +99,7 @@ export async function load_ae_obj_li__person(
hidden = 'not_hidden',
limit = 99,
offset = 0,
order_by_li = {'family_name': 'ASC', 'given_name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
order_by_li = [{'family_name': 'ASC'}, {'given_name': 'ASC'}, {'updated_on': 'DESC'}, {'created_on': 'DESC'}],
// params_json = {},
params = {},
try_cache = true,
@@ -110,11 +110,11 @@ export async function load_ae_obj_li__person(
for_obj_id: string,
qry_email?: string|null,
qry_user_id?: string|null,
enabled?: string, // all, disabled, enabled
hidden?: string, // all, hidden, not_hidden
enabled?: "enabled" | "all" | "not_enabled" | undefined, // all, disabled, enabled
hidden?: "hidden" | "all" | "not_hidden" | undefined, // all, hidden, not_hidden
limit?: number,
offset?: number,
order_by_li?: key_val,
order_by_li?: { [key: string]: "ASC" | "DESC" }[] | null,
// params_json?: null|key_val,
params?: key_val,
try_cache?: boolean,
@@ -688,13 +688,13 @@ async function _process_generic_props<T extends Record<string, any>>({
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const new_key = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
(processed_obj as any)[new_key] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const random_id_key = `${obj_type}_id_random`;
if (processed_obj[random_id_key]) {
processed_obj.id = processed_obj[randomIdKey];
(processed_obj as any).id = processed_obj[random_id_key];
}
// 2. Create common computed properties for client-side sorting.

View File

@@ -340,7 +340,7 @@ async function get_url_cfg(cfg) {
}
return return_data;
})
.catch(function (error) {
.catch(function (error: any) {
console.log(`Base URL: ${base_url} | Endpoint: ${endpoint}`);
console.log('Error Message:', error.message); // Is this needed here or below in the in the else portion???

View File

@@ -122,7 +122,7 @@ async function handle_obj_field_patch(new_field_value: any) {
}
return true;
})
.catch(function (error) {
.catch(function (error: any) {
console.log('Something went wrong patching the record.');
console.log(error);
return false;

View File

@@ -224,7 +224,7 @@ async function handle_get_device_info(event_device_id) {
console.log(up_event_device_result);
}
})
.catch(function (error) {
.catch(function (error: any) {
console.log('No results returned or failed.');
console.log(error);
});

View File

@@ -237,7 +237,7 @@ let ae_promises: key_val = $state({});
}).then(() => {
// Optionally, you can provide feedback to the user
alert('Journal entry deleted successfully!');
}).catch((error) => {
}).catch((error: any) => {
console.error('Error deleting journal entry:', error);
alert('Failed to delete journal entry.');
}).finally(() => {