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.
|
||||
params = {},
|
||||
// return_meta = false,
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
|
||||
@@ -11,8 +11,8 @@ export async function handle_load_ae_obj_id__person(
|
||||
{
|
||||
api_cfg,
|
||||
person_id,
|
||||
try_cache=false,
|
||||
log_lvl=0
|
||||
try_cache = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
person_id: string,
|
||||
@@ -63,9 +63,9 @@ export async function handle_load_ae_obj_li__person(
|
||||
offset = 0,
|
||||
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
params_json = null,
|
||||
params={},
|
||||
try_cache=true,
|
||||
log_lvl=0
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
for_obj_type: string,
|
||||
@@ -127,8 +127,8 @@ export async function handle_create_ae_obj__person(
|
||||
api_cfg,
|
||||
user_id,
|
||||
data_kv,
|
||||
params={},
|
||||
log_lvl=0
|
||||
params = {},
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
user_id?: string,
|
||||
@@ -181,8 +181,8 @@ export async function handle_update_ae_obj__person(
|
||||
api_cfg,
|
||||
person_id,
|
||||
data_kv,
|
||||
params={},
|
||||
log_lvl=0
|
||||
params = {},
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
person_id: string,
|
||||
@@ -230,7 +230,7 @@ export function handle_db_save_ae_obj_li__person(
|
||||
{
|
||||
obj_type,
|
||||
obj_li,
|
||||
log_lvl=0
|
||||
log_lvl = 0
|
||||
}: {
|
||||
obj_type: string,
|
||||
obj_li: any,
|
||||
@@ -247,80 +247,100 @@ export function handle_db_save_ae_obj_li__person(
|
||||
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 {
|
||||
const id_random = await db_core.person.put({
|
||||
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}`);
|
||||
id_random = await db_core.person.update(obj_record.id, obj_record);
|
||||
} catch (error) {
|
||||
let status = `Failed to put ${obj.person_id_random}: ${error}`;
|
||||
console.log(status);
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
|
||||
// const id_random = await db_core.person.put(obj);
|
||||
// console.log(`Put obj with ID: ${obj.person_id_random}`);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function auth_ae_obj__username_password(
|
||||
password,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
account_id: string,
|
||||
@@ -88,7 +88,7 @@ export async function auth_ae_obj__user_id_user_auth_key(
|
||||
user_auth_key,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
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'
|
||||
params = {},
|
||||
// try_cache = true,
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
account_id: string,
|
||||
@@ -232,7 +232,7 @@ export async function qry_ae_obj_li__user_email(
|
||||
email,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
account_id: string,
|
||||
|
||||
@@ -243,7 +243,7 @@ export async function update_ae_obj__event_file(
|
||||
event_file_id,
|
||||
data_kv,
|
||||
params = {},
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
event_file_id: string,
|
||||
|
||||
@@ -329,7 +329,7 @@ export async function db_save_ae_obj_li__journal_entry(
|
||||
}
|
||||
) {
|
||||
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) {
|
||||
|
||||
@@ -319,7 +319,7 @@ export let update_ae_obj_id_crud = async function update_ae_obj_id_crud(
|
||||
return_obj = false,
|
||||
obj_v_name = '',
|
||||
return_meta = false,
|
||||
log_lvl = 1
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
|
||||
Reference in New Issue
Block a user