Last round of prettier: npx prettier --write src/
This commit is contained in:
@@ -29,7 +29,9 @@ export async function load_ae_obj_id__event_presenter({
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresenter | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__event_presenter() *** [V3] id=${event_presenter_id} (SWR)`);
|
||||
console.log(
|
||||
`*** load_ae_obj_id__event_presenter() *** [V3] id=${event_presenter_id} (SWR)`
|
||||
);
|
||||
}
|
||||
|
||||
// 1. FAST PATH: Cache hit
|
||||
@@ -38,30 +40,71 @@ export async function load_ae_obj_id__event_presenter({
|
||||
const cached = await db_events.presenter.get(event_presenter_id);
|
||||
if (cached) {
|
||||
// Background refresh (non-blocking)
|
||||
_refresh_presenter_id_background({ api_cfg, event_presenter_id, view, try_cache, inc_file_li, log_lvl: 0 });
|
||||
_refresh_presenter_id_background({
|
||||
api_cfg,
|
||||
event_presenter_id,
|
||||
view,
|
||||
try_cache,
|
||||
inc_file_li,
|
||||
log_lvl: 0
|
||||
});
|
||||
return cached;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// 2. SLOW PATH: Wait for API
|
||||
return await _refresh_presenter_id_background({ api_cfg, event_presenter_id, view, try_cache, inc_file_li, log_lvl });
|
||||
return await _refresh_presenter_id_background({
|
||||
api_cfg,
|
||||
event_presenter_id,
|
||||
view,
|
||||
try_cache,
|
||||
inc_file_li,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
async function _refresh_presenter_id_background({ api_cfg, event_presenter_id, view, try_cache, inc_file_li, log_lvl }: any) {
|
||||
async function _refresh_presenter_id_background({
|
||||
api_cfg,
|
||||
event_presenter_id,
|
||||
view,
|
||||
try_cache,
|
||||
inc_file_li,
|
||||
log_lvl
|
||||
}: any) {
|
||||
if (typeof navigator !== 'undefined' && !navigator.onLine) return null;
|
||||
try {
|
||||
const result = await api.get_ae_obj({ api_cfg, obj_type: 'event_presenter', obj_id: event_presenter_id, view, log_lvl });
|
||||
const result = await api.get_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'event_presenter',
|
||||
obj_id: event_presenter_id,
|
||||
view,
|
||||
log_lvl
|
||||
});
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], log_lvl });
|
||||
const processed = await process_ae_obj__event_presenter_props({
|
||||
obj_li: [result],
|
||||
log_lvl
|
||||
});
|
||||
const processed_obj = processed[0];
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presenter', obj_li: [processed_obj], properties_to_save, log_lvl });
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
if (inc_file_li) {
|
||||
processed_obj.event_file_li = await load_ae_obj_li__event_file({
|
||||
api_cfg, for_obj_type: 'event_presenter', for_obj_id: event_presenter_id,
|
||||
enabled: 'all', limit: 25, try_cache: false, log_lvl
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presenter',
|
||||
for_obj_id: event_presenter_id,
|
||||
enabled: 'all',
|
||||
limit: 25,
|
||||
try_cache: false,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
@@ -104,7 +147,9 @@ export async function load_ae_obj_li__event_presenter({
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresenter[]> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__event_presenter() *** [V3] for=${for_obj_type}:${for_obj_id} (SWR)`);
|
||||
console.log(
|
||||
`*** load_ae_obj_li__event_presenter() *** [V3] for=${for_obj_type}:${for_obj_id} (SWR)`
|
||||
);
|
||||
}
|
||||
|
||||
// 1. FAST PATH: Check cache using specific indices
|
||||
@@ -112,31 +157,94 @@ export async function load_ae_obj_li__event_presenter({
|
||||
try {
|
||||
let cached_li: any[] = [];
|
||||
if (for_obj_type === 'event_presentation') {
|
||||
cached_li = await db_events.presenter.where('event_presentation_id').equals(for_obj_id).toArray();
|
||||
cached_li = await db_events.presenter
|
||||
.where('event_presentation_id')
|
||||
.equals(for_obj_id)
|
||||
.toArray();
|
||||
} else if (for_obj_type === 'event_session') {
|
||||
cached_li = await db_events.presenter.where('event_session_id').equals(for_obj_id).toArray();
|
||||
cached_li = await db_events.presenter
|
||||
.where('event_session_id')
|
||||
.equals(for_obj_id)
|
||||
.toArray();
|
||||
} else if (for_obj_type === 'event') {
|
||||
cached_li = await db_events.presenter.where('event_id').equals(for_obj_id).toArray();
|
||||
cached_li = await db_events.presenter
|
||||
.where('event_id')
|
||||
.equals(for_obj_id)
|
||||
.toArray();
|
||||
}
|
||||
|
||||
if (cached_li && cached_li.length > 0) {
|
||||
// Background refresh (non-blocking)
|
||||
_refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl: 0 });
|
||||
_refresh_presenter_li_background({
|
||||
api_cfg,
|
||||
for_obj_type,
|
||||
for_obj_id,
|
||||
inc_file_li,
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
try_cache,
|
||||
log_lvl: 0
|
||||
});
|
||||
return cached_li;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// 2. SLOW PATH: Wait for API
|
||||
return await _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl });
|
||||
return await _refresh_presenter_li_background({
|
||||
api_cfg,
|
||||
for_obj_type,
|
||||
for_obj_id,
|
||||
inc_file_li,
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
try_cache,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj_id, inc_file_li, enabled, hidden, view, limit, offset, order_by_li, try_cache, log_lvl }: any) {
|
||||
async function _refresh_presenter_li_background({
|
||||
api_cfg,
|
||||
for_obj_type,
|
||||
for_obj_id,
|
||||
inc_file_li,
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
try_cache,
|
||||
log_lvl
|
||||
}: any) {
|
||||
if (typeof navigator !== 'undefined' && !navigator.onLine) return [];
|
||||
try {
|
||||
const result_li = await api.get_ae_obj_li({ api_cfg, obj_type: 'event_presenter', for_obj_type, for_obj_id, enabled, hidden, view, limit, offset, order_by_li, log_lvl });
|
||||
const result_li = await api.get_ae_obj_li({
|
||||
api_cfg,
|
||||
obj_type: 'event_presenter',
|
||||
for_obj_type,
|
||||
for_obj_id,
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
log_lvl
|
||||
});
|
||||
if (result_li) {
|
||||
const processed = await process_ae_obj__event_presenter_props({ obj_li: result_li, log_lvl });
|
||||
const processed = await process_ae_obj__event_presenter_props({
|
||||
obj_li: result_li,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
// String-Only ID Vision: Ensure linking ID is set for indexing
|
||||
processed.forEach((p) => {
|
||||
@@ -155,7 +263,13 @@ async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj
|
||||
});
|
||||
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presenter', obj_li: processed, properties_to_save, log_lvl });
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: processed,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
// CRITICAL FIX (2026-02-26): Yield to microtask queue so Dexie liveQuery observers
|
||||
// fire before we return. Without this, component-mounted liveQueries may subscribe
|
||||
// to IDB *before* the write completes, causing empty results on cold-start.
|
||||
@@ -164,10 +278,15 @@ async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj
|
||||
|
||||
// Background nested loads for refreshed items (FIRE AND FORGET)
|
||||
if (inc_file_li) {
|
||||
processed.forEach(p => {
|
||||
processed.forEach((p) => {
|
||||
load_ae_obj_li__event_file({
|
||||
api_cfg, for_obj_type: 'event_presenter', for_obj_id: p.id,
|
||||
enabled: 'all', limit: 25, try_cache: false, log_lvl: 0
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presenter',
|
||||
for_obj_id: p.id,
|
||||
enabled: 'all',
|
||||
limit: 25,
|
||||
try_cache: false,
|
||||
log_lvl: 0
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -180,128 +299,143 @@ async function _refresh_presenter_li_background({ api_cfg, for_obj_type, for_obj
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
export async function create_ae_obj__event_presenter({
|
||||
api_cfg,
|
||||
event_presentation_id,
|
||||
data_kv,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
api_cfg,
|
||||
event_presentation_id,
|
||||
data_kv,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_presentation_id?: string;
|
||||
data_kv: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
api_cfg: any;
|
||||
event_presentation_id?: string;
|
||||
data_kv: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresenter | null> {
|
||||
if (!event_presentation_id) event_presentation_id = get(events_slct).event_presentation_id;
|
||||
if (!event_presentation_id)
|
||||
event_presentation_id = get(events_slct).event_presentation_id;
|
||||
if (!event_presentation_id) {
|
||||
console.error('create_ae_obj__event_presenter: event_presentation_id is required');
|
||||
console.error(
|
||||
'create_ae_obj__event_presenter: event_presentation_id is required'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
obj_type: 'event_presenter',
|
||||
fields: { ...data_kv },
|
||||
log_lvl
|
||||
});
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
obj_type: 'event_presenter',
|
||||
fields: { ...data_kv },
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], log_lvl });
|
||||
const processed_obj = processed[0];
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__event_presenter_props({
|
||||
obj_li: [result],
|
||||
log_lvl
|
||||
});
|
||||
const processed_obj = processed[0];
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
export async function delete_ae_obj_id__event_presenter({
|
||||
api_cfg,
|
||||
event_presentation_id,
|
||||
event_presenter_id,
|
||||
method = 'delete',
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
api_cfg,
|
||||
event_presentation_id,
|
||||
event_presenter_id,
|
||||
method = 'delete',
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_presentation_id?: string;
|
||||
event_presenter_id: string;
|
||||
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
api_cfg: any;
|
||||
event_presentation_id?: string;
|
||||
event_presenter_id: string;
|
||||
method?: 'delete' | 'soft_delete' | 'disable' | 'hide';
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (!event_presentation_id) event_presentation_id = get(events_slct).event_presentation_id;
|
||||
if (!event_presentation_id)
|
||||
event_presentation_id = get(events_slct).event_presentation_id;
|
||||
if (!event_presentation_id) {
|
||||
console.error('delete_ae_obj_id__event_presenter: event_presentation_id is required');
|
||||
console.error(
|
||||
'delete_ae_obj_id__event_presenter: event_presentation_id is required'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
const result = await api.delete_nested_ae_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
obj_type: 'event_presenter',
|
||||
obj_id: event_presenter_id,
|
||||
method,
|
||||
log_lvl
|
||||
});
|
||||
if (try_cache) await db_events.presenter.delete(event_presenter_id);
|
||||
return result;
|
||||
const result = await api.delete_nested_ae_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
obj_type: 'event_presenter',
|
||||
obj_id: event_presenter_id,
|
||||
method,
|
||||
log_lvl
|
||||
});
|
||||
if (try_cache) await db_events.presenter.delete(event_presenter_id);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
export async function update_ae_obj__event_presenter({
|
||||
api_cfg,
|
||||
event_presentation_id,
|
||||
event_presenter_id,
|
||||
data_kv,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
api_cfg,
|
||||
event_presentation_id,
|
||||
event_presenter_id,
|
||||
data_kv,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
event_presentation_id?: string;
|
||||
event_presenter_id: string;
|
||||
data_kv: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
api_cfg: any;
|
||||
event_presentation_id?: string;
|
||||
event_presenter_id: string;
|
||||
data_kv: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresenter | null> {
|
||||
if (!event_presentation_id) event_presentation_id = get(events_slct).event_presentation_id;
|
||||
if (!event_presentation_id)
|
||||
event_presentation_id = get(events_slct).event_presentation_id;
|
||||
if (!event_presentation_id) {
|
||||
console.error('update_ae_obj__event_presenter: event_presentation_id is required');
|
||||
console.error(
|
||||
'update_ae_obj__event_presenter: event_presentation_id is required'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
obj_type: 'event_presenter',
|
||||
obj_id: event_presenter_id,
|
||||
fields: data_kv,
|
||||
log_lvl
|
||||
});
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__event_presenter_props({ obj_li: [result], log_lvl });
|
||||
const processed_obj = processed[0];
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
obj_type: 'event_presenter',
|
||||
obj_id: event_presenter_id,
|
||||
fields: data_kv,
|
||||
log_lvl
|
||||
});
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__event_presenter_props({
|
||||
obj_li: [result],
|
||||
log_lvl
|
||||
});
|
||||
const processed_obj = processed[0];
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Updated 2026-01-21 to Restore Full Aether Search Logic
|
||||
@@ -320,7 +454,11 @@ export async function search__event_presenter({
|
||||
view = 'default',
|
||||
limit = 25,
|
||||
offset = 0,
|
||||
order_by_li = [{ sort: 'ASC' }, { given_name: 'ASC' }, { family_name: 'ASC' }],
|
||||
order_by_li = [
|
||||
{ sort: 'ASC' },
|
||||
{ given_name: 'ASC' },
|
||||
{ family_name: 'ASC' }
|
||||
],
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
@@ -342,29 +480,71 @@ export async function search__event_presenter({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresenter[]> {
|
||||
const search_query: any = { q: '', and: [{ field: 'event_id', op: 'eq', value: event_id }] };
|
||||
const search_query: any = {
|
||||
q: '',
|
||||
and: [{ field: 'event_id', op: 'eq', value: event_id }]
|
||||
};
|
||||
const params: key_val = {};
|
||||
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2)
|
||||
params['ft_qry'] = { default_qry_str: fulltext_search_qry_str };
|
||||
if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2)
|
||||
params['ft_qry'] = { ...params['ft_qry'], event_presenter_li_qry_str: ft_presenter_search_qry_str };
|
||||
if (like_search_qry_str) params['lk_qry'] = { default_qry_str: like_search_qry_str };
|
||||
params['ft_qry'] = {
|
||||
...params['ft_qry'],
|
||||
event_presenter_li_qry_str: ft_presenter_search_qry_str
|
||||
};
|
||||
if (like_search_qry_str)
|
||||
params['lk_qry'] = { default_qry_str: like_search_qry_str };
|
||||
if (like_presentation_search_qry_str)
|
||||
params['lk_qry'] = { ...params['lk_qry'], event_presentation_li_qry_str: like_presentation_search_qry_str };
|
||||
params['lk_qry'] = {
|
||||
...params['lk_qry'],
|
||||
event_presentation_li_qry_str: like_presentation_search_qry_str
|
||||
};
|
||||
if (like_presenter_search_qry_str)
|
||||
params['lk_qry'] = { ...params['lk_qry'], event_presenter_li_qry_str: like_presenter_search_qry_str };
|
||||
if (agree !== null) search_query.and.push({ field: 'agree', op: 'eq', value: agree ? 1 : 0 });
|
||||
if (biography === true) search_query.and.push({ field: 'biography', op: 'ne', value: '' });
|
||||
if (enabled === 'enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
|
||||
else if (enabled === 'not_enabled') search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
|
||||
if (hidden === 'hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
|
||||
else if (hidden === 'not_hidden') search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
|
||||
params['lk_qry'] = {
|
||||
...params['lk_qry'],
|
||||
event_presenter_li_qry_str: like_presenter_search_qry_str
|
||||
};
|
||||
if (agree !== null)
|
||||
search_query.and.push({
|
||||
field: 'agree',
|
||||
op: 'eq',
|
||||
value: agree ? 1 : 0
|
||||
});
|
||||
if (biography === true)
|
||||
search_query.and.push({ field: 'biography', op: 'ne', value: '' });
|
||||
if (enabled === 'enabled')
|
||||
search_query.and.push({ field: 'enable', op: 'eq', value: 1 });
|
||||
else if (enabled === 'not_enabled')
|
||||
search_query.and.push({ field: 'enable', op: 'eq', value: 0 });
|
||||
if (hidden === 'hidden')
|
||||
search_query.and.push({ field: 'hide', op: 'eq', value: 1 });
|
||||
else if (hidden === 'not_hidden')
|
||||
search_query.and.push({ field: 'hide', op: 'eq', value: 0 });
|
||||
|
||||
const result_li = await api.search_ae_obj({ api_cfg, obj_type: 'event_presenter', search_query, order_by_li, params, view, limit, offset, log_lvl });
|
||||
const result_li = await api.search_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'event_presenter',
|
||||
search_query,
|
||||
order_by_li,
|
||||
params,
|
||||
view,
|
||||
limit,
|
||||
offset,
|
||||
log_lvl
|
||||
});
|
||||
if (result_li) {
|
||||
const processed = await process_ae_obj__event_presenter_props({ obj_li: result_li, log_lvl });
|
||||
const processed = await process_ae_obj__event_presenter_props({
|
||||
obj_li: result_li,
|
||||
log_lvl
|
||||
});
|
||||
if (try_cache) {
|
||||
await db_save_ae_obj_li__ae_obj({ db_instance: db_events, table_name: 'presenter', obj_li: processed, properties_to_save, log_lvl });
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_events,
|
||||
table_name: 'presenter',
|
||||
obj_li: processed,
|
||||
properties_to_save,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
@@ -400,8 +580,16 @@ export async function email_sign_in__event_presenter({
|
||||
session_name?: string | null;
|
||||
presentation_name?: string | null;
|
||||
}) {
|
||||
if (!to_email || !person_id || !person_passcode || !event_id || !event_presenter_id) {
|
||||
console.error('Missing required parameters for email_sign_in__event_presenter');
|
||||
if (
|
||||
!to_email ||
|
||||
!person_id ||
|
||||
!person_passcode ||
|
||||
!event_id ||
|
||||
!event_presenter_id
|
||||
) {
|
||||
console.error(
|
||||
'Missing required parameters for email_sign_in__event_presenter'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
const subject = `Pres Mgmt Hub Sign In Link for Presenter: ${to_name ?? 'Presenter'}`;
|
||||
@@ -420,10 +608,75 @@ export async function email_sign_in__event_presenter({
|
||||
}
|
||||
|
||||
export const properties_to_save = [
|
||||
'id', 'event_presenter_id', 'event_presenter_id_random', 'external_id', 'code', 'event_id', 'event_session_id', 'event_presentation_id', 'event_person_id', 'person_id', 'person_profile_id', 'person_id_random', 'person_profile_id_random', 'pronouns', 'informal_name', 'title_names', 'given_name', 'middle_name', 'family_name', 'designations', 'professional_title', 'full_name', 'affiliations', 'email', 'biography', 'agree', 'comments', 'passcode', 'hide_event_launcher', 'data_json', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on', 'tmp_sort_1', 'tmp_sort_2', 'file_count', 'event_session_code', 'event_session_name', 'event_session_start_datetime', 'event_presentation_code', 'event_presentation_name', 'event_presentation_start_datetime', 'person_external_id', 'person_external_sys_id', 'person_given_name', 'person_family_name', 'person_full_name', 'person_professional_title', 'person_affiliations', 'person_primary_email', 'person_passcode'
|
||||
'id',
|
||||
'event_presenter_id',
|
||||
'event_presenter_id_random',
|
||||
'external_id',
|
||||
'code',
|
||||
'event_id',
|
||||
'event_session_id',
|
||||
'event_presentation_id',
|
||||
'event_person_id',
|
||||
'person_id',
|
||||
'person_profile_id',
|
||||
'person_id_random',
|
||||
'person_profile_id_random',
|
||||
'pronouns',
|
||||
'informal_name',
|
||||
'title_names',
|
||||
'given_name',
|
||||
'middle_name',
|
||||
'family_name',
|
||||
'designations',
|
||||
'professional_title',
|
||||
'full_name',
|
||||
'affiliations',
|
||||
'email',
|
||||
'biography',
|
||||
'agree',
|
||||
'comments',
|
||||
'passcode',
|
||||
'hide_event_launcher',
|
||||
'data_json',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
'tmp_sort_1',
|
||||
'tmp_sort_2',
|
||||
'file_count',
|
||||
'event_session_code',
|
||||
'event_session_name',
|
||||
'event_session_start_datetime',
|
||||
'event_presentation_code',
|
||||
'event_presentation_name',
|
||||
'event_presentation_start_datetime',
|
||||
'person_external_id',
|
||||
'person_external_sys_id',
|
||||
'person_given_name',
|
||||
'person_family_name',
|
||||
'person_full_name',
|
||||
'person_professional_title',
|
||||
'person_affiliations',
|
||||
'person_primary_email',
|
||||
'person_passcode'
|
||||
];
|
||||
|
||||
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[]> {
|
||||
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 (!obj_li || obj_li.length === 0) return [];
|
||||
const processed_obj_li: T[] = [];
|
||||
for (const original_obj of obj_li) {
|
||||
@@ -439,28 +692,50 @@ async function _process_generic_props<T extends Record<string, any>>({ obj_li, o
|
||||
if (processed_obj[randomIdKey]) {
|
||||
(processed_obj as any).id = processed_obj[randomIdKey];
|
||||
(processed_obj as any)[baseIdKey] = processed_obj[randomIdKey];
|
||||
}
|
||||
else if (processed_obj[baseIdKey]) (processed_obj as any).id = processed_obj[baseIdKey];
|
||||
} else if (processed_obj[baseIdKey])
|
||||
(processed_obj as any).id = processed_obj[baseIdKey];
|
||||
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 ?? new Date(0).toISOString();
|
||||
const updated =
|
||||
processed_obj.updated_on ??
|
||||
processed_obj.created_on ??
|
||||
new Date(0).toISOString();
|
||||
const name = processed_obj.name ?? '';
|
||||
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
if (specific_processor) processed_obj = await Promise.resolve(specific_processor(processed_obj));
|
||||
(processed_obj as any).tmp_sort_1 =
|
||||
`${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 =
|
||||
`${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
if (specific_processor)
|
||||
processed_obj = await Promise.resolve(
|
||||
specific_processor(processed_obj)
|
||||
);
|
||||
processed_obj_li.push(processed_obj as T);
|
||||
}
|
||||
return processed_obj_li;
|
||||
}
|
||||
|
||||
export async function process_ae_obj__event_presenter_props({ 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) => {
|
||||
// String-Only ID Vision: Ensure linking IDs are the string versions for indexing
|
||||
if (obj.event_presenter_id_random) obj.event_presenter_id = obj.event_presenter_id_random;
|
||||
if (obj.event_presentation_id_random) obj.event_presentation_id = obj.event_presentation_id_random;
|
||||
if (obj.event_session_id_random) obj.event_session_id = obj.event_session_id_random;
|
||||
if (obj.event_id_random) obj.event_id = obj.event_id_random;
|
||||
return obj;
|
||||
}});
|
||||
export async function process_ae_obj__event_presenter_props({
|
||||
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) => {
|
||||
// String-Only ID Vision: Ensure linking IDs are the string versions for indexing
|
||||
if (obj.event_presenter_id_random)
|
||||
obj.event_presenter_id = obj.event_presenter_id_random;
|
||||
if (obj.event_presentation_id_random)
|
||||
obj.event_presentation_id = obj.event_presentation_id_random;
|
||||
if (obj.event_session_id_random)
|
||||
obj.event_session_id = obj.event_session_id_random;
|
||||
if (obj.event_id_random) obj.event_id = obj.event_id_random;
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user