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:
@@ -3,36 +3,10 @@ import { api } from '$lib/api/api';
|
||||
|
||||
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||
import { db_core } from '$lib/ae_core/db_core';
|
||||
import type { ae_Account } from '$lib/types/ae_types';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
export interface Account {
|
||||
id: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
code?: string;
|
||||
name: string;
|
||||
short_name?: null | string;
|
||||
description?: null | string;
|
||||
|
||||
enable: null | boolean;
|
||||
enable_from?: null | Date;
|
||||
enable_to?: null | Date;
|
||||
|
||||
hide?: null | boolean;
|
||||
priority?: null | boolean;
|
||||
sort?: null | number;
|
||||
group?: null | string;
|
||||
notes?: null | string;
|
||||
created_on: Date;
|
||||
updated_on?: null | Date;
|
||||
|
||||
// Computed or extra fields from views
|
||||
tmp_sort_1?: string;
|
||||
tmp_sort_2?: string;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function load_ae_obj_id__account({
|
||||
api_cfg,
|
||||
@@ -48,7 +22,7 @@ export async function load_ae_obj_id__account({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Account | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__account() *** account_id=${account_id}`);
|
||||
}
|
||||
@@ -120,7 +94,7 @@ export async function load_ae_obj_li__account({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Account[]> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__account() ***`);
|
||||
}
|
||||
@@ -174,7 +148,7 @@ export async function create_ae_obj__account({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Account | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** create_ae_obj__account() ***`);
|
||||
}
|
||||
@@ -230,7 +204,7 @@ export async function update_ae_obj__account({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Account | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** update_ae_obj__account() *** account_id=${account_id}`, data_kv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user