test: combine and modernize private-network checks; remove legacy disabled variants
This commit is contained in:
@@ -295,65 +295,87 @@ async function _refresh_exhibit_li_background({ api_cfg, event_id, enabled, hidd
|
||||
* Exhibit Create (V3)
|
||||
*/
|
||||
export async function create_ae_obj__exhibit({
|
||||
api_cfg, event_id, data_kv, try_cache = true, log_lvl = 0
|
||||
api_cfg,
|
||||
event_id,
|
||||
data_kv,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any; event_id: string; data_kv: key_val; try_cache?: boolean; log_lvl?: number;
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
data_kv: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibit | null> {
|
||||
const result = await api.create_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'event_exhibit',
|
||||
fields: { event_id: event_id, ...data_kv },
|
||||
log_lvl
|
||||
});
|
||||
const result = await api.create_nested_obj_v3({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
obj_type: 'event_exhibit',
|
||||
fields: { ...data_kv },
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__exhibit_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: 'exhibit',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save: properties_to_save_exhibit,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__exhibit_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: 'exhibit',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save: properties_to_save_exhibit,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exhibit Update (V3)
|
||||
*/
|
||||
export async function update_ae_obj__exhibit({
|
||||
api_cfg, exhibit_id, data_kv, try_cache = true, log_lvl = 0
|
||||
api_cfg,
|
||||
event_id,
|
||||
exhibit_id,
|
||||
data_kv,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any; exhibit_id: string; data_kv: key_val; try_cache?: boolean; log_lvl?: number;
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
exhibit_id: string;
|
||||
data_kv: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibit | null> {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'event_exhibit',
|
||||
obj_id: exhibit_id,
|
||||
fields: data_kv,
|
||||
log_lvl
|
||||
});
|
||||
const result = await api.update_nested_obj_v3({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
obj_type: 'event_exhibit',
|
||||
obj_id: exhibit_id,
|
||||
fields: data_kv,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__exhibit_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: 'exhibit',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save: properties_to_save_exhibit,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
if (result) {
|
||||
const processed = await process_ae_obj__exhibit_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: 'exhibit',
|
||||
obj_li: [processed_obj],
|
||||
properties_to_save: properties_to_save_exhibit,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
return processed_obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user