First part of of getting the IDAA Archives to use the newer method to save to the IDB.
This commit is contained in:
@@ -730,3 +730,118 @@ export function db_save_ae_obj_li__archive(
|
|||||||
return true;
|
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;
|
||||||
|
}
|
||||||
@@ -400,3 +400,148 @@ export async function db_save_ae_obj_li__archive_content(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Updated 2025-06-04
|
||||||
|
export const properties_to_save = [
|
||||||
|
'id',
|
||||||
|
'archive_content_id',
|
||||||
|
// 'archive_content_id_random',
|
||||||
|
|
||||||
|
'archive_id',
|
||||||
|
// 'archive_id_random',
|
||||||
|
|
||||||
|
'archive_content_type',
|
||||||
|
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
|
||||||
|
'content_html',
|
||||||
|
'content_json',
|
||||||
|
|
||||||
|
'url',
|
||||||
|
'url_text',
|
||||||
|
|
||||||
|
'hosted_file_id',
|
||||||
|
'hosted_file_id_random',
|
||||||
|
|
||||||
|
'file_path',
|
||||||
|
|
||||||
|
'filename',
|
||||||
|
'file_extension',
|
||||||
|
|
||||||
|
'original_datetime',
|
||||||
|
'original_timezone',
|
||||||
|
'original_location',
|
||||||
|
'original_url',
|
||||||
|
'original_url_text',
|
||||||
|
|
||||||
|
'enable_for_public',
|
||||||
|
|
||||||
|
'cfg_json',
|
||||||
|
|
||||||
|
'enable',
|
||||||
|
'hide',
|
||||||
|
'priority',
|
||||||
|
'sort',
|
||||||
|
'group',
|
||||||
|
'notes',
|
||||||
|
'created_on',
|
||||||
|
'updated_on',
|
||||||
|
|
||||||
|
// Generated fields for sorting locally only
|
||||||
|
'tmp_sort_1',
|
||||||
|
'tmp_sort_2',
|
||||||
|
|
||||||
|
// From SQL view
|
||||||
|
'archive_code',
|
||||||
|
'archive_name',
|
||||||
|
|
||||||
|
'hash_sha256'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// Updated 2025-06-04
|
||||||
|
export async function process_ae_obj__archive_content_props({
|
||||||
|
obj_li,
|
||||||
|
log_lvl = 0,
|
||||||
|
}: {
|
||||||
|
obj_li: any[];
|
||||||
|
log_lvl?: number;
|
||||||
|
}) {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`*** process_ae_obj__archive_content_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_content:`, obj);
|
||||||
|
|
||||||
|
let processed_obj = {
|
||||||
|
id: obj.archive_content_id_random,
|
||||||
|
archive_content_id: obj.archive_content_id_random,
|
||||||
|
// archive_content_id_random: obj.archive_content_id_random,
|
||||||
|
|
||||||
|
archive_id: obj.archive_id_random,
|
||||||
|
// archive_id_random: obj.archive_id_random,
|
||||||
|
|
||||||
|
archive_content_type: obj.archive_content_type,
|
||||||
|
|
||||||
|
name: obj.name,
|
||||||
|
description: obj.description,
|
||||||
|
|
||||||
|
content_html: obj.content_html,
|
||||||
|
content_json: obj.content_json,
|
||||||
|
|
||||||
|
url: obj.url,
|
||||||
|
url_text: obj.url_text,
|
||||||
|
|
||||||
|
hosted_file_id: obj.hosted_file_id_random,
|
||||||
|
hosted_file_id_random: obj.hosted_file_id_random,
|
||||||
|
|
||||||
|
file_path: obj.file_path,
|
||||||
|
|
||||||
|
filename: obj.filename,
|
||||||
|
file_extension: obj.file_extension,
|
||||||
|
|
||||||
|
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,
|
||||||
|
|
||||||
|
enable_for_public: obj.enable_for_public,
|
||||||
|
|
||||||
|
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.tmp_sort_1,
|
||||||
|
tmp_sort_2: obj.tmp_sort_2,
|
||||||
|
|
||||||
|
// From SQL view
|
||||||
|
archive_code: obj.archive_code,
|
||||||
|
archive_name: obj.archive_name,
|
||||||
|
|
||||||
|
hash_sha256: obj.hosted_file_hash_sha256
|
||||||
|
};
|
||||||
|
|
||||||
|
processed_obj_li.push(processed_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return processed_obj_li;
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export async function load({ params, parent }) { // route
|
|||||||
console.log(`ae_idaa_archives archives [archive_id] +page.ts: archive_id = `, archive_id);
|
console.log(`ae_idaa_archives archives [archive_id] +page.ts: archive_id = `, archive_id);
|
||||||
}
|
}
|
||||||
// Load event archive object
|
// Load event archive object
|
||||||
let load_archive_obj = archives_func.load_ae_obj_id__archive({
|
let load_archive_obj = await archives_func.load_ae_obj_id__archive({
|
||||||
api_cfg: ae_acct.api,
|
api_cfg: ae_acct.api,
|
||||||
archive_id: archive_id,
|
archive_id: archive_id,
|
||||||
inc_content_li: true,
|
inc_content_li: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user