First part of of getting the IDAA Archives to use the newer method to save to the IDB.

This commit is contained in:
Scott Idem
2025-06-04 12:04:41 -04:00
parent 695a520eb3
commit 83ff5681d6
3 changed files with 261 additions and 1 deletions

View File

@@ -730,3 +730,118 @@ export function db_save_ae_obj_li__archive(
return true;
}
}
// Updated 2025-06-04
export const properties_to_save = [
'id',
'archive_id',
// 'archive_id_random',
'code',
'account_id',
// 'account_id_random',
'name',
'description',
'original_datetime',
'original_timezone',
'original_location',
'original_url',
'original_url_text',
'sort_by',
'sort_by_desc',
'cfg_json',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
// From SQL view
// 'archive_content_count',
// A key value list of the contents
// 'archive_content_kv',
// 'archive_content_li',
];
// Updated 2025-06-04
export async function process_ae_obj__archive_props({
obj_li,
log_lvl = 0,
}: {
obj_li: any[];
log_lvl?: number;
}) {
if (log_lvl) {
console.log(`*** process_ae_obj__archive_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 archive:`, obj);
let processed_obj = {
id: obj.archive_id_random,
archive_id: obj.archive_id_random,
// archive_id_random: obj.archive_id_random,
code: obj.code,
account_id: obj.account_id_random,
// account_id_random: obj.account_id_random,
name: obj.name,
description: obj.description,
original_datetime: obj.original_datetime,
original_timezone: obj.original_timezone,
original_location: obj.original_location,
original_url: obj.original_url,
original_url_text: obj.original_url_text,
sort_by: obj.sort_by,
sort_by_desc: obj.sort_by_desc,
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,
// From SQL view
// archive_content_count: obj.archive_content_count,
// A key value list of the contents
// archive_content_kv: obj.archive_content_kv,
// archive_content_li: obj.archive_content_li,
};
processed_obj_li.push(processed_obj);
}
return processed_obj_li;
}