Quick snapshot again as Gemini is working.

This commit is contained in:
Scott Idem
2025-11-13 12:44:28 -05:00
parent dfaa27384b
commit db8c0e0d05
14 changed files with 1294 additions and 1297 deletions

View File

@@ -1144,124 +1144,94 @@ export const properties_to_save = [
];
// Updated 2025-05-09
export async function process_ae_obj__event_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_props() ***`, obj_li);
}
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) {
console.log('No objects to process.');
}
return [];
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
const processed_obj_li: T[] = [];
for (const obj of obj_li) {
if (log_lvl) {
console.log(`Processing ae_obj event:`, obj);
}
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// Create the processed object
let processed_obj = {
id: obj.event_id_random,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
// --- Common Transformations ---
code: obj.event_code,
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
account_id: obj.account_id_random,
account_id_random: obj.account_id_random,
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
conference: obj.conference,
type: obj.type,
name: obj.name,
summary: obj.summary,
description: obj.description,
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
start_datetime: obj.start_datetime,
end_datetime: obj.end_datetime,
timezone: obj.timezone,
location_address_json: obj.location_address_json,
location_text: obj.location_text,
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
attend_json: obj.attend_json,
attend_text: obj.attend_text,
processed_obj_li.push(processed_obj as T);
}
status: obj.status, // draft, active, inactive, archived, unknown; currently only used with IDAA
// review: obj.review,
// approve: obj.approve,
// ready: obj.ready,
// ready_on: obj.ready_on,
// archive: obj.archive,
// archive_on: obj.archive_on,
mod_abstracts_json: obj.mod_abstracts_json,
mod_badges_json: obj.mod_badges_json,
mod_exhibits_json: obj.mod_exhibits_json,
mod_meetings_json: obj.mod_meetings_json,
mod_pres_mgmt_json: obj.mod_pres_mgmt_json,
cfg_json: obj.cfg_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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// IDAA Recovery Meetings:
// Currently only really used for IDAA
contact_li_json: obj.contact_li_json,
external_person_id: obj.external_person_id,
physical: obj.physical,
virtual: obj.virtual,
recurring: obj.recurring,
recurring_pattern: obj.recurring_pattern,
recurring_start_time: obj.recurring_start_time,
recurring_end_time: obj.recurring_end_time,
recurring_text: obj.recurring_text,
weekday_sunday: obj.weekday_sunday,
weekday_monday: obj.weekday_monday,
weekday_tuesday: obj.weekday_tuesday,
weekday_wednesday: obj.weekday_wednesday,
weekday_thursday: obj.weekday_thursday,
weekday_friday: obj.weekday_friday,
weekday_saturday: obj.weekday_saturday,
attend_url: obj.attend_url,
attend_url_text: obj.attend_url_text,
attend_url_code: obj.attend_url_code,
attend_url_passcode: obj.attend_url_passcode,
attend_phone: obj.attend_phone,
attend_phone_passcode: obj.attend_phone_passcode,
// From SQL view
file_count: obj.file_count,
file_count_all: obj.file_count_all,
internal_use_count: obj.internal_use_count,
event_file_id_li_json: obj.event_file_id_li_json,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return processed_obj_li;
}
// Updated 2025-11-13
export async function process_ae_obj__event_props({
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event',
log_lvl,
specific_processor: (obj) => {
// Handle event-specific property aliases
if (obj.event_code) {
obj.code = obj.event_code;
}
return obj;
}
});
}

View File

@@ -10,10 +10,10 @@ let ae_promises: key_val = {};
export const properties_to_save = [
'id',
'event_badge_template_id',
'event_badge_template_id_random',
// 'event_badge_template_id_random',
'event_id',
'event_id_random',
// 'event_id_random',
'name',
'description',
@@ -82,82 +82,99 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// --- PROCESS FUNCTION ---
export async function process_ae_obj__event_badge_template_props({
obj_li,
log_lvl = 0,
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_badge_template_props() ***`, obj_li);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_badge_template:`, obj);
let processed_obj = {
id: obj.event_badge_template_id_random,
event_badge_template_id: obj.event_badge_template_id_random,
event_badge_template_id_random: obj.event_badge_template_id_random,
return _process_generic_props({
obj_li,
obj_type: 'event_badge_template',
log_lvl,
specific_processor: (obj) => {
// Event badge template-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
name: obj.name,
description: obj.description,
logo_filename: obj.logo_filename,
logo_path: obj.logo_path,
header_path: obj.header_path,
secondary_header_path: obj.secondary_header_path,
footer_path: obj.footer_path,
header_row_1: obj.header_row_1,
header_row_2: obj.header_row_2,
badge_type_list: obj.badge_type_list,
ticket_list: obj.ticket_list,
ticket_1_text: obj.ticket_1_text,
ticket_2_text: obj.ticket_2_text,
ticket_3_text: obj.ticket_3_text,
ticket_4_text: obj.ticket_4_text,
ticket_5_text: obj.ticket_5_text,
ticket_6_text: obj.ticket_6_text,
ticket_7_text: obj.ticket_7_text,
ticket_8_text: obj.ticket_8_text,
wireless_ssid: obj.wireless_ssid,
wireless_password: obj.wireless_password,
show_qr_front: obj.show_qr_front,
show_qr_back: obj.show_qr_back,
layout: obj.layout,
style_filename: obj.style_filename,
// default: obj.default,
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,
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}

View File

@@ -686,12 +686,12 @@ export function db_save_ae_obj_li__event_device(
export const properties_to_save = [
'id',
'event_device_id',
'event_device_id_random',
// 'event_device_id_random',
'event_id',
'event_id_random',
// 'event_id_random',
'event_location_id',
'event_location_id_random',
// 'event_location_id_random',
'code',
'name',
@@ -753,98 +753,102 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// Updated 2025-05-23
export async function process_ae_obj__event_device_props({
obj_li,
log_lvl = 0,
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_location_props() ***`, obj_li);
}
return _process_generic_props({
obj_li,
obj_type: 'event_device',
log_lvl,
specific_processor: (obj) => {
// Special handling for heartbeat timestamp
if (obj.heartbeat) {
obj.heartbeat = obj.heartbeat + 'Z';
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
// Event device-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_device:`, obj);
let processed_obj = {
id: obj.event_device_id_random,
event_device_id: obj.event_device_id_random,
event_device_id_random: obj.event_device_id_random,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_location_id: obj.event_location_id_random,
event_location_id_random: obj.event_location_id_random,
code: obj.code,
name: obj.name,
description: obj.description,
passcode: obj.passcode,
local_file_cache_path: obj.local_file_cache_path,
host_file_temp_path: obj.host_file_temp_path,
recording_path: obj.recording_path,
record_audio: obj.record_audio,
record_video: obj.record_video,
trigger_open_file_id: obj.trigger_open_file_id,
trigger_open_session_id: obj.trigger_open_session_id,
trigger_recording_start: obj.trigger_recording_start,
trigger_recording_stop: obj.trigger_recording_stop,
trigger_reset: obj.trigger_reset,
trigger_show_admin: obj.trigger_show_admin,
trigger_show_hidden: obj.trigger_show_hidden,
alert: obj.alert,
alert_msg: obj.alert_msg,
alert_on: obj.alert_on,
status: obj.status,
status_msg: obj.status_msg,
status_on: obj.status_on,
record_status: obj.record_status,
record_status_msg: obj.record_status_msg,
record_status_on: obj.record_status_on,
// These are timestamps that are in UTC but missing the 'Z' at the end
heartbeat: obj.heartbeat ? obj.heartbeat+'Z' : null,
info_hostname: obj.info_hostname,
info_ip_list: obj.info_ip_list,
meta_json: obj.meta_json,
other_json: obj.other_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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
event_name: obj.event_name,
event_location_code: obj.event_location_code,
event_location_name: obj.event_location_name,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}

View File

@@ -869,15 +869,15 @@ export const properties_to_save = [
'id',
// 'id_random',
'event_file_id',
'event_file_id_random',
// 'event_file_id_random',
'hosted_file_id',
'hosted_file_id_random',
// 'hosted_file_id_random',
'hash_sha256',
'for_type',
'for_id',
'for_id_random',
// 'for_id_random',
'event_id',
// 'event_id_random',
@@ -939,101 +939,97 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// Updated 2025-05-23
export async function process_ae_obj__event_file_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_file_props() ***`, obj_li);
}
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_file',
log_lvl,
specific_processor: (obj) => {
// Event file-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_file:`, obj);
let processed_obj = {
id: obj.event_file_id_random,
// id_random: obj.event_file_id_random,
event_file_id: obj.event_file_id_random,
event_file_id_random: obj.event_file_id_random,
hosted_file_id: obj.hosted_file_id_random,
hosted_file_id_random: obj.hosted_file_id_random,
hash_sha256: obj.hash_sha256,
for_type: obj.for_type,
for_id: obj.for_id_random,
for_id_random: obj.for_id_random,
event_id: obj.event_id_random,
// event_id_random: obj.event_id_random,
event_session_id: obj.event_session_id_random,
// event_session_id_random: obj.event_session_id_random,
event_presentation_id: obj.event_presentation_id_random,
// event_presentation_id_random: obj.event_presentation_id_random,
event_presenter_id: obj.event_presenter_id_random,
// event_presenter_id_random: obj.event_presenter_id_random,
event_location_id: obj.event_location_id_random,
// event_location_id_random: obj.event_location_id_random,
filename: obj.filename,
extension: obj.extension,
open_in_os: obj.open_in_os,
lu_file_purpose_id: obj.lu_file_purpose_id, // Not id_random in this case?
lu_event_file_purpose_name: obj.lu_event_file_purpose_name,
file_purpose: obj.file_purpose,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
filename_no_ext: obj.filename_no_ext,
filename_w_ext: obj.filename_w_ext,
hosted_file_content_type: obj.hosted_file_content_type,
file_size: obj.file_size,
hosted_file_size: obj.hosted_file_size,
event_location_code: obj.event_location_code,
event_location_name: obj.event_location_name,
event_session_code: obj.event_session_code,
event_session_type_code: obj.event_session_type_code,
event_session_name: obj.event_session_name,
event_session_start_datetime: obj.event_session_start_datetime,
event_session_end_datetime: obj.event_session_end_datetime,
event_presentation_code: obj.event_presentation_code,
event_presentation_type_code: obj.event_presentation_type_code,
event_presentation_name: obj.event_presentation_name,
event_presentation_start_datetime: obj.event_presentation_start_datetime,
event_presentation_end_datetime: obj.event_presentation_end_datetime,
event_presenter_given_name: obj.event_presenter_given_name,
event_presenter_family_name: obj.event_presenter_family_name,
event_presenter_full_name: obj.event_presenter_full_name,
event_presenter_email: obj.event_presenter_email,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}

View File

@@ -774,7 +774,7 @@ export function db_save_ae_obj_li__event_location(
export const properties_to_save = [
'id',
'event_location_id',
'event_location_id_random',
// 'event_location_id_random',
'external_id',
'code',
@@ -782,7 +782,7 @@ export const properties_to_save = [
'type_code',
'event_id',
'event_id_random',
// 'event_id_random',
'name',
'description',
@@ -821,77 +821,97 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// Updated 2025-05-23
export async function process_ae_obj__event_location_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_location_props() ***`, obj_li);
}
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_location',
log_lvl,
specific_processor: (obj) => {
// Event location-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_location:`, obj);
let processed_obj = {
id: obj.event_location_id_random,
event_location_id: obj.event_location_id_random,
event_location_id_random: obj.event_location_id_random,
external_id: obj.external_id,
code: obj.code,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
name: obj.name,
description: obj.description,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
alert: obj.alert,
alert_msg: obj.alert_msg,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
file_count: obj.file_count,
file_count_all: obj.file_count_all,
internal_use_count: obj.internal_use_count,
event_file_id_li_json: obj.event_file_id_li_json,
event_name: obj.event_name,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}

View File

@@ -656,23 +656,23 @@ export function db_save_ae_obj_li__event_presentation(
export const properties_to_save = [
'id',
'event_presentation_id',
'event_presentation_id_random',
// 'event_presentation_id_random',
'external_id',
'code',
'for_type',
'for_id',
'for_id_random',
// 'for_id_random',
'type_code',
'event_id',
'event_id_random',
// 'event_id_random',
'event_session_id',
'event_session_id_random',
// 'event_session_id_random',
'event_abstract_id',
'event_abstract_id_random',
// 'event_abstract_id_random',
'abstract_code',
@@ -709,85 +709,97 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// Updated 2025-05-22
export async function process_ae_obj__event_presentation_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_presentation_props() ***`, obj_li);
}
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_presentation',
log_lvl,
specific_processor: (obj) => {
// Event presentation-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
if (!obj_li || obj_li.length === 0) {
if (log_lvl) {
console.log('No objects to process.');
}
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) {
console.log(`Processing ae_obj event_presentation:`, obj);
}
let processed_obj = {
id: obj.event_presentation_id_random,
event_presentation_id: obj.event_presentation_id_random,
event_presentation_id_random: obj.event_presentation_id_random,
external_id: obj.external_id,
code: obj.code,
for_type: obj.for_type,
for_id: obj.for_id_random,
for_id_random: obj.for_id_random,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_session_id: obj.event_session_id_random,
event_session_id_random: obj.event_session_id_random,
event_abstract_id: obj.event_abstract_id_random,
event_abstract_id_random: obj.event_abstract_id_random,
abstract_code: obj.abstract_code,
name: obj.name,
description: obj.description,
start_datetime: obj.start_datetime,
end_datetime: obj.end_datetime,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
event_session_code: obj.event_session_code,
event_session_name: obj.event_session_name,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}

View File

@@ -826,7 +826,7 @@ export async function email_sign_in__event_presenter (
export const properties_to_save = [
'id',
'event_presenter_id',
'event_presenter_id_random',
// 'event_presenter_id_random',
'external_id',
'code',
@@ -836,17 +836,17 @@ export const properties_to_save = [
// 'for_id_random',
'event_id',
'event_id_random',
// 'event_id_random',
'event_session_id',
'event_session_id_random',
// 'event_session_id_random',
'event_presentation_id',
'event_presentation_id_random',
// 'event_presentation_id_random',
'event_person_id',
'event_person_id_random',
// 'event_person_id_random',
'person_id',
'person_id_random',
// 'person_id_random',
'person_profile_id',
'person_profile_id_random',
// 'person_profile_id_random',
'pronouns',
'informal_name',
@@ -912,116 +912,97 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// Updated 2025-05-23
export async function process_ae_obj__event_presenter_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_presenter_props() ***`, obj_li);
}
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_presenter',
log_lvl,
specific_processor: (obj) => {
// Event presenter-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
if (!obj_li || obj_li.length === 0) {
if (log_lvl) console.log('No objects to process.');
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) console.log(`Processing ae_obj event_presenter:`, obj);
let processed_obj = {
id: obj.event_presenter_id_random,
event_presenter_id: obj.event_presenter_id_random,
event_presenter_id_random: obj.event_presenter_id_random,
external_id: obj.external_id,
code: obj.code,
// for_type: obj.for_type,
// for_id: obj.for_id,
// for_id_random: obj.for_id_random,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_session_id: obj.event_session_id_random,
event_session_id_random: obj.event_session_id_random,
event_presentation_id: obj.event_presentation_id_random,
event_presentation_id_random: obj.event_presentation_id_random,
event_person_id: obj.event_person_id_random,
event_person_id_random: obj.event_person_id_random,
person_id: obj.person_id_random,
person_id_random: obj.person_id_random,
person_profile_id: obj.person_profile_id_random,
person_profile_id_random: obj.person_profile_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,
email: obj.email,
biography: obj.biography,
agree: obj.agree,
comments: obj.comments,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
file_count: obj.file_count,
event_session_code: obj.event_session_code,
event_session_name: obj.event_session_name,
event_session_start_datetime: obj.event_session_start_datetime,
event_presentation_code: obj.event_presentation_code,
event_presentation_name: obj.event_presentation_name,
event_presentation_start_datetime: obj.event_presentation_start_datetime,
person_external_id: obj.person_external_id,
person_external_sys_id: obj.person_external_sys_id,
person_given_name: obj.person_given_name,
person_family_name: obj.person_family_name,
person_full_name: obj.person_full_name,
person_professional_title: obj.person_professional_title,
person_affiliations: obj.person_affiliations,
person_primary_email: obj.person_primary_email,
person_passcode: obj.person_passcode,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}

View File

@@ -1147,24 +1147,24 @@ export async function email_sign_in__event_session (
export const properties_to_save = [
'id',
'event_session_id',
'event_session_id_random',
// 'event_session_id_random',
'external_id',
'code',
'for_type',
'for_id',
'for_id_random',
// 'for_id_random',
'type_code',
'event_id',
'event_id_random',
// 'event_id_random',
'event_location_id',
'event_location_id_random',
// 'event_location_id_random',
'poc_person_id',
'poc_person_id_random',
// 'poc_person_id_random',
'poc_agree',
'poc_kv_json',
@@ -1223,111 +1223,97 @@ export const properties_to_save = [
];
/**
* NON-EXPORTED LOCAL HELPER
* Processes a list of Aether objects by applying common and specific transformations.
*/
async function _process_generic_props<T extends Record<string, any>>({
obj_li,
obj_type,
log_lvl = 0,
specific_processor
}: {
obj_li: T[];
obj_type: string;
log_lvl?: number;
specific_processor?: (obj: T) => Promise<T> | T;
}): Promise<T[]> {
if (log_lvl > 0) {
console.log(
`*** _process_generic_props: Processing ${obj_li.length} objects of type "${obj_type}" ***`
);
}
if (!obj_li || obj_li.length === 0) {
if (log_lvl > 0) console.log('No objects to process.');
return [];
}
const processed_obj_li: T[] = [];
for (const original_obj of obj_li) {
let processed_obj = { ...original_obj };
// --- Common Transformations ---
// 1. Standardize ID and other '_random' fields
// The API often returns fields like 'person_id_random', which need to be aliased to 'person_id'.
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7); // Remove '_random' suffix
processed_obj[newKey] = processed_obj[key];
}
}
// Ensure 'id' is set from '[obj_type]_id_random'
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
processed_obj.id = processed_obj[randomIdKey];
}
// 2. Create common computed properties for client-side sorting.
const group = processed_obj.group ?? '0';
const priority = processed_obj.priority ? 1 : 0;
const sort = processed_obj.sort ?? '0';
const updated = processed_obj.updated_on ?? processed_obj.created_on;
const name = processed_obj.name ?? '';
processed_obj.tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
processed_obj.tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
// --- Specific Transformations ---
if (specific_processor) {
processed_obj = await Promise.resolve(specific_processor(processed_obj));
}
processed_obj_li.push(processed_obj as T);
}
return processed_obj_li;
}
// Updated 2025-05-09
export async function process_ae_obj__event_session_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__event_session_props() ***`, obj_li);
}
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'event_session',
log_lvl,
specific_processor: (obj) => {
// Event session-specific computed sort fields, overriding generic ones if needed
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on ?? obj.created_on}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
obj.sort?.toString().padStart(3, '0') ?? ''
}_${obj.updated_on}_${obj.created_on}`;
if (!obj_li || obj_li.length === 0) {
if (log_lvl) {
console.log('No objects to process.');
}
return [];
}
const processed_obj_li = [];
for (const obj of obj_li) {
if (log_lvl) {
console.log(`Processing ae_obj event_session:`, obj);
}
// Create the processed object
let processed_obj = {
id: obj.event_session_id_random,
event_session_id: obj.event_session_id_random,
event_session_id_random: obj.event_session_id_random,
external_id: obj.external_id,
code: obj.code,
for_type: obj.for_type,
for_id: obj.for_id,
for_id_random: obj.for_id_random,
type_code: obj.type_code,
event_id: obj.event_id_random,
event_id_random: obj.event_id_random,
event_location_id: obj.event_location_id_random,
event_location_id_random: obj.event_location_id_random,
poc_person_id: obj.poc_person_id_random,
poc_person_id_random: obj.poc_person_id_random,
poc_agree: obj.poc_agree,
poc_kv_json: obj.poc_kv_json ?? {},
name: obj.name,
description: obj.description,
start_datetime: obj.start_datetime,
end_datetime: obj.end_datetime,
passcode: obj.passcode,
hide_event_launcher: obj.hide_event_launcher,
alert: obj.alert,
alert_msg: obj.alert_msg,
data_json: obj.data_json,
ux_mode: obj.ux_mode,
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,
// Generated fields for sorting locally only
tmp_sort_1: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on ?? obj.created_on}`,
tmp_sort_2: `${obj.group}_${obj.priority}_${obj.sort}_${obj.updated_on}_${obj.created_on}`,
// From SQL view
file_count: obj.file_count,
file_count_all: obj.file_count_all,
internal_use_count: obj.internal_use_count,
event_file_id_li_json: obj.event_file_id_li_json,
poc_person_given_name: obj.poc_person_given_name,
poc_person_family_name: obj.poc_person_family_name,
poc_person_full_name: obj.poc_person_full_name,
poc_person_primary_email: obj.poc_person_primary_email,
poc_person_passcode: obj.poc_person_passcode,
event_name: obj.event_name,
event_location_code: obj.event_location_code,
event_location_name: obj.event_location_name,
// A key value list of the presentations
event_presentation_kv: obj.event_presentation_kv,
event_presentation_li: obj.event_presentation_li,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
return obj;
}
});
}