Initialized Activity Log IndexedDB infrastructure and refactored Jitsi reports.

Added 'activity_log' table to Dexie 'ae_core_db' (v4) to support local caching of tracking data.

Implemented 'process_ae_obj__activity_log_props' with robust timestamp fallbacks.

Refactored 'qry__jitsi_report' to follow the Frontier module pattern, ensuring consistent V3 search and local cache synchronization.
This commit is contained in:
Scott Idem
2026-02-16 16:13:04 -05:00
parent 4711f41c34
commit fb724411d3
3 changed files with 169 additions and 27 deletions

View File

@@ -268,4 +268,104 @@ export async function qry__activity_log({
}
// Updated 2026-02-16
export const properties_to_save = [
'id',
'activity_log_id',
'activity_log_id_random',
'account_id',
'account_id_random',
'person_id',
'person_id_random',
'user_id',
'user_id_random',
'external_client_id',
'source',
'object_type',
'object_id',
'object_id_random',
'name',
'action',
'action_on_type',
'action_on_id',
'action_on_id_random',
'description',
'details',
'other_json',
'meta_json',
'enable',
'hide',
'priority',
'sort',
'group',
'notes',
'created_on',
'updated_on',
'tmp_sort_1',
'tmp_sort_2',
'tmp_sort_3'
];
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) {
let processed_obj = { ...original_obj };
for (const key in processed_obj) {
if (key.endsWith('_random')) {
const newKey = key.slice(0, -7);
(processed_obj as any)[newKey] = processed_obj[key];
}
}
const randomIdKey = `${obj_type}_id_random`;
if (processed_obj[randomIdKey]) {
(processed_obj as any).id = processed_obj[randomIdKey];
}
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 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_li.push(processed_obj as T);
}
return processed_obj_li;
}
export async function process_ae_obj__activity_log_props({
obj_li,
log_lvl = 0
}: {
obj_li: any[];
log_lvl?: number;
}) {
return _process_generic_props({
obj_li,
obj_type: 'activity_log',
log_lvl
});
}

View File

@@ -8,7 +8,8 @@ import type {
ae_SiteDomain,
ae_Address,
ae_Contact,
ae_DataStore
ae_DataStore,
ae_ActivityLog
} from '$lib/types/ae_types';
// li = list
@@ -61,7 +62,7 @@ export interface Person extends ae_Person {
address_id_random?: string;
}
// Updated 2026-01-28 - Unified Types and added Data Store
// Updated 2026-02-16 - Added Activity Log
export class MySubClassedDexie extends Dexie {
file!: Table<ae_LocalFile>;
person!: Table<Person>;
@@ -72,10 +73,11 @@ export class MySubClassedDexie extends Dexie {
address!: Table<ae_Address>;
contact!: Table<ae_Contact>;
data_store!: Table<ae_DataStore>;
activity_log!: Table<ae_ActivityLog>;
constructor() {
super('ae_core_db');
this.version(3).stores({
this.version(4).stores({
file: `
id, hosted_file_id, hosted_file_id_random,
hash_sha256,
@@ -138,6 +140,14 @@ export class MySubClassedDexie extends Dexie {
[code+for_type+for_id_random],
[code+account_id_random+for_type],
[code+account_id_random],
enable, hide, priority, sort, group, created_on, updated_on`,
activity_log: `
id, activity_log_id, activity_log_id_random,
account_id, account_id_random,
person_id_random, user_id_random,
external_client_id, object_type, object_id_random,
name, action,
enable, hide, priority, sort, group, created_on, updated_on`
});
}