Less other debug while working on Journals
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ export async function handle_load_ae_obj_id__person(
|
|||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
person_id,
|
person_id,
|
||||||
try_cache=false,
|
try_cache = false,
|
||||||
log_lvl=0
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
person_id: string,
|
person_id: string,
|
||||||
@@ -63,9 +63,9 @@ export async function handle_load_ae_obj_li__person(
|
|||||||
offset = 0,
|
offset = 0,
|
||||||
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||||
params_json = null,
|
params_json = null,
|
||||||
params={},
|
params = {},
|
||||||
try_cache=true,
|
try_cache = true,
|
||||||
log_lvl=0
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
for_obj_type: string,
|
for_obj_type: string,
|
||||||
@@ -127,8 +127,8 @@ export async function handle_create_ae_obj__person(
|
|||||||
api_cfg,
|
api_cfg,
|
||||||
user_id,
|
user_id,
|
||||||
data_kv,
|
data_kv,
|
||||||
params={},
|
params = {},
|
||||||
log_lvl=0
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
user_id?: string,
|
user_id?: string,
|
||||||
@@ -181,8 +181,8 @@ export async function handle_update_ae_obj__person(
|
|||||||
api_cfg,
|
api_cfg,
|
||||||
person_id,
|
person_id,
|
||||||
data_kv,
|
data_kv,
|
||||||
params={},
|
params = {},
|
||||||
log_lvl=0
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
person_id: string,
|
person_id: string,
|
||||||
@@ -230,7 +230,7 @@ export function handle_db_save_ae_obj_li__person(
|
|||||||
{
|
{
|
||||||
obj_type,
|
obj_type,
|
||||||
obj_li,
|
obj_li,
|
||||||
log_lvl=0
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
obj_type: string,
|
obj_type: string,
|
||||||
obj_li: any,
|
obj_li: any,
|
||||||
@@ -247,80 +247,100 @@ export function handle_db_save_ae_obj_li__person(
|
|||||||
console.log(`ae_obj ${obj_type}:`, obj);
|
console.log(`ae_obj ${obj_type}:`, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let obj_record = {
|
||||||
|
id: obj.person_id_random,
|
||||||
|
// id_random: obj.person_id_random,
|
||||||
|
person_id: obj.person_id_random,
|
||||||
|
person_id_random: obj.person_id_random,
|
||||||
|
|
||||||
|
external_id: obj.external_id,
|
||||||
|
external_sys_id: obj.external_sys_id,
|
||||||
|
code: obj.code,
|
||||||
|
|
||||||
|
account_id: obj.account_id_random,
|
||||||
|
account_id_random: obj.account_id_random,
|
||||||
|
|
||||||
|
person_profile_id: obj.person_profile_id_random,
|
||||||
|
person_profile_id_random: obj.person_profile_id_random, // The new table person_profile will be used soon...
|
||||||
|
|
||||||
|
user_id: obj.user_id_random,
|
||||||
|
user_id_random: obj.user_id_random,
|
||||||
|
|
||||||
|
pronouns: obj.pronouns,
|
||||||
|
informal_name: obj.informal_name,
|
||||||
|
title_names: obj.title_names,
|
||||||
|
given_name: obj.given_name,
|
||||||
|
middle_name: obj.middle_name,
|
||||||
|
family_name: obj.family_name,
|
||||||
|
designations: obj.designations,
|
||||||
|
|
||||||
|
professional_title: obj.professional_title,
|
||||||
|
|
||||||
|
full_name: obj.full_name,
|
||||||
|
|
||||||
|
affiliations: obj.affiliations,
|
||||||
|
|
||||||
|
primary_email: obj.primary_email,
|
||||||
|
|
||||||
|
biography: obj.biography,
|
||||||
|
|
||||||
|
agree: obj.agree,
|
||||||
|
comments: obj.comments,
|
||||||
|
|
||||||
|
allow_auth_key: obj.allow_auth_key, // For sign in without password
|
||||||
|
// auth_key: obj.auth_key,
|
||||||
|
passcode: obj.passcode,
|
||||||
|
|
||||||
|
data_json: obj.data_json,
|
||||||
|
|
||||||
|
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
|
||||||
|
username: obj.username,
|
||||||
|
user_name: obj.user_name,
|
||||||
|
user_email: obj.user_email,
|
||||||
|
user_allow_auth_key: obj.user_allow_auth_key, // For sign in without password
|
||||||
|
user_super: obj.user_super,
|
||||||
|
user_manager: obj.user_manager,
|
||||||
|
user_administrator: obj.user_administrator,
|
||||||
|
user_public: obj.user_public,
|
||||||
|
};
|
||||||
|
|
||||||
|
let id_random = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const id_random = await db_core.person.put({
|
id_random = await db_core.person.update(obj_record.id, obj_record);
|
||||||
id: obj.person_id_random,
|
|
||||||
// id_random: obj.person_id_random,
|
|
||||||
person_id: obj.person_id_random,
|
|
||||||
person_id_random: obj.person_id_random,
|
|
||||||
|
|
||||||
external_id: obj.external_id,
|
|
||||||
external_sys_id: obj.external_sys_id,
|
|
||||||
code: obj.code,
|
|
||||||
|
|
||||||
account_id: obj.account_id_random,
|
|
||||||
account_id_random: obj.account_id_random,
|
|
||||||
|
|
||||||
person_profile_id: obj.person_profile_id_random,
|
|
||||||
person_profile_id_random: obj.person_profile_id_random, // The new table person_profile will be used soon...
|
|
||||||
|
|
||||||
user_id: obj.user_id_random,
|
|
||||||
user_id_random: obj.user_id_random,
|
|
||||||
|
|
||||||
pronouns: obj.pronouns,
|
|
||||||
informal_name: obj.informal_name,
|
|
||||||
title_names: obj.title_names,
|
|
||||||
given_name: obj.given_name,
|
|
||||||
middle_name: obj.middle_name,
|
|
||||||
family_name: obj.family_name,
|
|
||||||
designations: obj.designations,
|
|
||||||
|
|
||||||
professional_title: obj.professional_title,
|
|
||||||
|
|
||||||
full_name: obj.full_name,
|
|
||||||
|
|
||||||
affiliations: obj.affiliations,
|
|
||||||
|
|
||||||
primary_email: obj.primary_email,
|
|
||||||
|
|
||||||
biography: obj.biography,
|
|
||||||
|
|
||||||
agree: obj.agree,
|
|
||||||
comments: obj.comments,
|
|
||||||
|
|
||||||
allow_auth_key: obj.allow_auth_key, // For sign in without password
|
|
||||||
// auth_key: obj.auth_key,
|
|
||||||
passcode: obj.passcode,
|
|
||||||
|
|
||||||
data_json: obj.data_json,
|
|
||||||
|
|
||||||
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
|
|
||||||
username: obj.username,
|
|
||||||
user_name: obj.user_name,
|
|
||||||
user_email: obj.user_email,
|
|
||||||
user_allow_auth_key: obj.user_allow_auth_key, // For sign in without password
|
|
||||||
user_super: obj.user_super,
|
|
||||||
user_manager: obj.user_manager,
|
|
||||||
user_administrator: obj.user_administrator,
|
|
||||||
user_public: obj.user_public,
|
|
||||||
});
|
|
||||||
// console.log(`Put obj with ID: ${obj.person_id_random} or ${id_random}`);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let status = `Failed to put ${obj.person_id_random}: ${error}`;
|
console.log(`Error: Failed to update ${obj_record.id}: ${error}`);
|
||||||
console.log(status);
|
}
|
||||||
|
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}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const id_random = await db_core.person.put(obj);
|
|
||||||
// console.log(`Put obj with ID: ${obj.person_id_random}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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 = {};
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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 = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user