Less other debug while working on Journals

This commit is contained in:
Scott Idem
2025-04-09 13:11:09 -04:00
parent e1848dddb5
commit adda3e79c5
13 changed files with 123 additions and 96 deletions

View File

@@ -25,7 +25,7 @@ export async function get_ae_obj_li_for_obj_id_crud_v2(
// json_obj = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. // json_obj = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
params = {}, params = {},
// return_meta = false, // return_meta = false,
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
obj_type: string, obj_type: string,

View File

@@ -247,8 +247,7 @@ export function handle_db_save_ae_obj_li__person(
console.log(`ae_obj ${obj_type}:`, obj); console.log(`ae_obj ${obj_type}:`, obj);
} }
try { let obj_record = {
const id_random = await db_core.person.put({
id: obj.person_id_random, id: obj.person_id_random,
// id_random: obj.person_id_random, // id_random: obj.person_id_random,
person_id: obj.person_id_random, person_id: obj.person_id_random,
@@ -312,15 +311,36 @@ export function handle_db_save_ae_obj_li__person(
user_manager: obj.user_manager, user_manager: obj.user_manager,
user_administrator: obj.user_administrator, user_administrator: obj.user_administrator,
user_public: obj.user_public, user_public: obj.user_public,
}); };
// console.log(`Put obj with ID: ${obj.person_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.person_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_core.person.put(obj); let id_random = null;
// console.log(`Put obj with ID: ${obj.person_id_random}`);
try {
id_random = await db_core.person.update(obj_record.id, obj_record);
} catch (error) {
console.log(`Error: Failed to update ${obj_record.id}: ${error}`);
}
if (!id_random) {
if (log_lvl) {
console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`);
}
try {
id_random = await db_core.person.put(obj_record);
} catch (error) {
console.log(`Error: Failed to put ${obj.person_id_random}: ${error}`);
}
} else {
if (log_lvl) {
console.log(`Updated record with ID: ${obj_record.id}`);
}
}
if (!id_random) {
console.log(`Failed to save record with ID: ${obj_record.id}`);
} else {
if (log_lvl) {
console.log(`Saved record with ID: ${obj_record.id}`);
}
}
}); });
return true; return true;

View File

@@ -16,7 +16,7 @@ export async function auth_ae_obj__username_password(
password, password,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
account_id: string, account_id: string,
@@ -88,7 +88,7 @@ export async function auth_ae_obj__user_id_user_auth_key(
user_auth_key, user_auth_key,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
account_id: string, account_id: string,
@@ -147,7 +147,7 @@ export async function send_email_auth_ae_obj__user_id(
key_param_name = 'user_key', // API defaults to 'auth_key' key_param_name = 'user_key', // API defaults to 'auth_key'
params = {}, params = {},
// try_cache = true, // try_cache = true,
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
account_id: string, account_id: string,
@@ -232,7 +232,7 @@ export async function qry_ae_obj_li__user_email(
email, email,
params = {}, params = {},
try_cache = true, try_cache = true,
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
account_id: string, account_id: string,

View File

@@ -243,7 +243,7 @@ export async function update_ae_obj__event_file(
event_file_id, event_file_id,
data_kv, data_kv,
params = {}, params = {},
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
event_file_id: string, event_file_id: string,

View File

@@ -329,7 +329,7 @@ export async function db_save_ae_obj_li__journal_entry(
} }
) { ) {
if (log_lvl) { if (log_lvl) {
console.log(`*** db_save_ae_obj_li__journal_entry() ***`); console.log(`*** db_save_ae_obj_li__journal_entry() ***`, log_lvl);
} }
if (obj_li && obj_li.length) { if (obj_li && obj_li.length) {

View File

@@ -319,7 +319,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
return_obj = false, return_obj = false,
obj_v_name = '', obj_v_name = '',
return_meta = false, return_meta = false,
log_lvl = 1 log_lvl = 0
}: { }: {
api_cfg: any, api_cfg: any,
obj_type: string, obj_type: string,

View File

@@ -14,7 +14,7 @@ import Element_manage_hosted_file_li_wrap from '$lib/element_manage_hosted_file_
let { data } = $props(); let { data } = $props();
let log_lvl = 1; let log_lvl = 0;
let ae_promises: key_val = {}; let ae_promises: key_val = {};

View File

@@ -5,7 +5,7 @@ import { browser } from '$app/environment';
import { journals_func } from '$lib/ae_journals/ae_journals_functions'; import { journals_func } from '$lib/ae_journals/ae_journals_functions';
export async function load({ params, parent }) { export async function load({ params, parent }) {
let log_lvl: number = 1; let log_lvl: number = 0;
let data = await parent(); let data = await parent();
data.log_lvl = log_lvl; data.log_lvl = log_lvl;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
/** @type {import('./$types').PageData} */ /** @type {import('./$types').PageData} */
let log_lvl: number = 1; let log_lvl: number = 0;
// *** Import Svelte specific // *** Import Svelte specific
import { browser } from '$app/environment'; import { browser } from '$app/environment';

View File

@@ -6,7 +6,7 @@ import { browser } from '$app/environment';
import { journals_func } from '$lib/ae_journals/ae_journals_functions'; import { journals_func } from '$lib/ae_journals/ae_journals_functions';
export async function load({ params, parent }) { // route export async function load({ params, parent }) { // route
let log_lvl: number = 1; let log_lvl: number = 0;
let data = await parent(); let data = await parent();
data.log_lvl = log_lvl; data.log_lvl = log_lvl;
@@ -36,7 +36,7 @@ export async function load({ params, parent }) { // route
api_cfg: ae_acct.api, api_cfg: ae_acct.api,
journal_entry_id: journal_entry_id, journal_entry_id: journal_entry_id,
try_cache: true, try_cache: true,
log_lvl: 2 log_lvl: log_lvl
}); });
ae_acct.slct.journal_obj = load_journal_obj; ae_acct.slct.journal_obj = load_journal_obj;

View File

@@ -58,12 +58,16 @@ let tmp_entry_obj: key_val = $state({});
$effect(() => { $effect(() => {
if ($lq__journal_entry_obj) { if ($lq__journal_entry_obj) {
tmp_entry_obj = { ...$lq__journal_entry_obj }; tmp_entry_obj = { ...$lq__journal_entry_obj };
} else {
console.log('TEST: No journal entry object available');
} }
}); });
$effect(() => { $effect(() => {
if (tmp_entry_obj) { if (tmp_entry_obj) {
tmp_entry_obj_changed = JSON.stringify(tmp_entry_obj) != JSON.stringify($lq__journal_entry_obj); tmp_entry_obj_changed = JSON.stringify(tmp_entry_obj) != JSON.stringify($lq__journal_entry_obj);
} else {
console.log('TEST: No tmp_entry_obj available');
} }
}); });

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
let log_lvl: number = 1; let log_lvl: number = 0;
// *** Import Svelte specific // *** Import Svelte specific
import { goto, invalidate, pushState, replaceState } from '$app/navigation'; import { goto, invalidate, pushState, replaceState } from '$app/navigation';

View File

@@ -18,7 +18,10 @@ interface Props {
lq__journal_entry_obj_li: any; lq__journal_entry_obj_li: any;
} }
let { log_lvl = 0, lq__journal_obj, lq__journal_entry_obj_li }: Props = $props(); let { log_lvl = 0,
lq__journal_obj,
lq__journal_entry_obj_li
}: Props = $props();
// let ae_promises: key_val = {}; // let ae_promises: key_val = {};
// let ae_tmp: key_val = {}; // let ae_tmp: key_val = {};