- Implement new Svelte 5 Person, Address, and Contact form components with surgical payload logic. - Refactor core routes (People, Addresses, Contacts) to support unified Create/Edit workflows. - Update ae_types.ts, db_core.ts, and db_journals.ts to align with V3 backend object models. - Fix type safety issues in Journal history views and refine metadata display. - Migrate person core functions to the newer ae_core__person module.
129 lines
3.1 KiB
TypeScript
129 lines
3.1 KiB
TypeScript
import Dexie, { type Table } from 'dexie';
|
|
|
|
import type { key_val } from '$lib/stores/ae_stores';
|
|
import type { ae_Journal, ae_JournalEntry } from '$lib/types/ae_types';
|
|
|
|
// li = list
|
|
// kv = key value list
|
|
// json = JSON string
|
|
// ux = user experience (mode)
|
|
// LLM = Large Language Model (AI)
|
|
// Updated 2026-01-09 - Unified Types
|
|
|
|
export interface Journal extends ae_Journal {
|
|
// Add any Dexie-specific or legacy local-only fields here if not in ae_Journal
|
|
// Most fields are now in ae_Journal and ae_BaseObj
|
|
|
|
// For backward compatibility with some views that expect these
|
|
combined_passcode?: string;
|
|
person__given_name?: string;
|
|
person__family_name?: string;
|
|
person__full_name?: string;
|
|
person__primary_email?: string;
|
|
person__passcode?: string;
|
|
person__kv_json?: string;
|
|
|
|
journal_entry_kv?: key_val;
|
|
journal_entry_li?: any[];
|
|
journal_file_kv?: key_val;
|
|
journal_file_li?: any[];
|
|
}
|
|
|
|
export const journal_field_li = [
|
|
'id',
|
|
'journal_id',
|
|
'journal_id_random',
|
|
'account_id',
|
|
'account_id_random',
|
|
'person_id',
|
|
'person_id_random',
|
|
'code',
|
|
'name',
|
|
'short_name',
|
|
'summary',
|
|
'outline',
|
|
'description',
|
|
'type_code',
|
|
'tags',
|
|
'enable',
|
|
'hide',
|
|
'priority',
|
|
'sort',
|
|
'group',
|
|
'notes',
|
|
'created_on',
|
|
'updated_on',
|
|
'tmp_sort_1',
|
|
'tmp_sort_2',
|
|
'tmp_sort_3'
|
|
];
|
|
|
|
export interface Journal_Entry extends ae_JournalEntry {
|
|
// Add any Dexie-specific or legacy local-only fields here
|
|
person__given_name?: string;
|
|
person__family_name?: string;
|
|
person__full_name?: string;
|
|
person__primary_email?: string;
|
|
person__passcode?: string;
|
|
person__kv_json?: string;
|
|
|
|
journal_file_kv?: key_val;
|
|
journal_file_li?: any[];
|
|
}
|
|
|
|
export const journal_entry_field_li = [
|
|
'id',
|
|
'journal_entry_id',
|
|
'journal_entry_id_random',
|
|
'journal_id',
|
|
'journal_id_random',
|
|
'person_id',
|
|
'person_id_random',
|
|
'code',
|
|
'name',
|
|
'short_name',
|
|
'summary',
|
|
'outline',
|
|
'content',
|
|
'content_md_html',
|
|
'content_encrypted',
|
|
'enable',
|
|
'hide',
|
|
'priority',
|
|
'sort',
|
|
'group',
|
|
'notes',
|
|
'created_on',
|
|
'updated_on',
|
|
'tmp_sort_1',
|
|
'tmp_sort_2',
|
|
'tmp_sort_3'
|
|
];
|
|
|
|
export class MySubClassedDexie extends Dexie {
|
|
journal!: Table<Journal>;
|
|
journal_entry!: Table<Journal_Entry>;
|
|
|
|
constructor() {
|
|
super('ae_journals_db');
|
|
this.version(5).stores({
|
|
journal: `
|
|
id, journal_id, journal_id_random,
|
|
code,
|
|
account_id, account_id_random,
|
|
person_id, person_id_random,
|
|
name,
|
|
enable, hide, priority, sort, group, created_on, updated_on`,
|
|
journal_entry: `
|
|
id, journal_entry_id, journal_entry_id_random,
|
|
journal_id, journal_id_random,
|
|
code,
|
|
template,
|
|
name,
|
|
enable, hide, priority, sort, group, created_on, updated_on`
|
|
});
|
|
}
|
|
}
|
|
|
|
export const db_journals = new MySubClassedDexie();
|