refactor: Standardize data processing and update to Svelte 5 runes

This commit introduces a major refactoring of the data processing logic across multiple modules (events, archives, posts, sponsorships) to use a standardized pattern with . This improves consistency and maintainability.

Key changes:
- Replaced module-specific data processing with a generic helper.
- Removed deprecated  functions.
- Updated Svelte components to leverage the new Svelte 5 runes, simplifying state management.
- Fixed linting errors and updated test configurations.
- Added .
This commit is contained in:
Scott Idem
2025-11-17 16:38:54 -05:00
parent c4fa35e86e
commit a3b37a5df4
31 changed files with 979 additions and 1491 deletions

View File

@@ -406,96 +406,7 @@ export async function update_ae_obj__archive_content(
}
// This function will loop through the archive_content_obj_li and save each one to the DB.
// Updated 2024-09-25
export async function db_save_ae_obj_li__archive_content(
{
obj_type,
obj_li,
log_lvl = 0
}: {
obj_type: string,
obj_li: any,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** db_save_ae_obj_li__archive_content() ***`);
}
if (obj_li && obj_li.length) {
obj_li.forEach(async function (obj: any) {
if (log_lvl) {
console.log(`ae_obj ${obj_type}:`, obj);
}
try {
const id_random = await db_archives.content.put({
id: obj.archive_content_id_random,
archive_content_id: obj.archive_content_id_random,
archive_id: 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,
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.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`,
tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
// From SQL view
archive_code: obj.archive_code,
archive_name: obj.archive_name,
hash_sha256: obj.hosted_file_hash_sha256 ?? ''
});
// console.log(`Put obj with ID: ${obj.archive_content_id_random} or ${id_random}`);
} catch (error) {
let status = `Failed to put ${obj.archive_content_id_random}: ${error}`;
console.log(status);
}
// const id_random = await db_archives.content.put(obj);
// console.log(`Put obj with ID: ${obj.archive_content_id_random}`);
});
return true;
}
}
// Updated 2025-06-04