Implement unified frontend type system and migrate core modules
- Created src/lib/types/ae_types.ts to serve as the central repository for Aether object interfaces. - Standardized interfaces to include the triple-ID pattern (id, [type]_id, [type]_id_random) for Dexie and V3 API compatibility. - Migrated Account and JournalEntry modules to use ae_Account and ae_JournalEntry types. - Added explicit Promise return types to all core data loading, creation, and update functions in migrated modules.
This commit is contained in:
146
src/lib/types/ae_types.ts
Normal file
146
src/lib/types/ae_types.ts
Normal file
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Aether Unified Type Definitions (Frontend)
|
||||
* Standardized 2026-01-08 to align with Backend V3 exports and Dexie local storage patterns.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base properties shared by almost all Aether objects.
|
||||
*/
|
||||
export interface ae_BaseObj {
|
||||
id: string; // Primary key (maps to [obj_type]_id_random)
|
||||
|
||||
code?: string;
|
||||
name?: string;
|
||||
short_name?: string;
|
||||
description?: string;
|
||||
|
||||
enable: boolean;
|
||||
hide: boolean;
|
||||
archive?: boolean;
|
||||
archive_on?: string | Date;
|
||||
|
||||
priority: boolean;
|
||||
sort: number;
|
||||
group?: string;
|
||||
notes?: string;
|
||||
|
||||
created_on: string | Date;
|
||||
updated_on: string | Date;
|
||||
|
||||
// Standard frontend computed sort fields
|
||||
tmp_sort_1?: string;
|
||||
tmp_sort_2?: string;
|
||||
tmp_sort_3?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Account - Core client account
|
||||
*/
|
||||
export interface ae_Account extends ae_BaseObj {
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
account_cfg?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Site - A website or application instance
|
||||
*/
|
||||
export interface ae_Site extends ae_BaseObj {
|
||||
site_id: string;
|
||||
site_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
url_root?: string;
|
||||
site_cfg_json?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Site_Domain - A domain name mapped to a site
|
||||
*/
|
||||
export interface ae_SiteDomain extends ae_BaseObj {
|
||||
site_domain_id: string;
|
||||
site_domain_id_random: string;
|
||||
site_id: string;
|
||||
site_id_random: string;
|
||||
|
||||
fqdn: string;
|
||||
is_primary: boolean;
|
||||
redirect_to_primary: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Journal - A collection of entries
|
||||
*/
|
||||
export interface ae_Journal extends ae_BaseObj {
|
||||
journal_id: string;
|
||||
journal_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* JournalEntry - A discrete piece of content within a journal
|
||||
*/
|
||||
export interface ae_JournalEntry extends ae_BaseObj {
|
||||
journal_entry_id: string;
|
||||
journal_entry_id_random: string;
|
||||
journal_id: string;
|
||||
journal_id_random: string;
|
||||
|
||||
person_id?: string;
|
||||
person_id_random?: string;
|
||||
|
||||
journal_entry_type?: string;
|
||||
activity_code?: string;
|
||||
category_code?: string;
|
||||
type_code?: string;
|
||||
topic_code?: string;
|
||||
tags?: string;
|
||||
|
||||
public?: boolean;
|
||||
private?: boolean;
|
||||
personal?: boolean;
|
||||
professional?: boolean;
|
||||
|
||||
summary?: string;
|
||||
outline?: string;
|
||||
|
||||
content?: string;
|
||||
content_md_html?: string;
|
||||
content_html?: string;
|
||||
content_json?: any;
|
||||
content_encrypted?: string;
|
||||
|
||||
history?: string;
|
||||
history_md_html?: string;
|
||||
history_encrypted?: string;
|
||||
|
||||
passcode_hash?: string;
|
||||
|
||||
alert?: boolean;
|
||||
alert_msg?: string;
|
||||
|
||||
data_json?: any;
|
||||
|
||||
// SQL View fields
|
||||
journal_code?: string;
|
||||
journal_name?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Person - A human entity
|
||||
*/
|
||||
export interface ae_Person extends ae_BaseObj {
|
||||
person_id: string;
|
||||
person_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
first_name?: string;
|
||||
last_name?: string;
|
||||
full_name?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user