Migrate Core modules (Account, Site, Person, Activity Log) to Aether API CRUD V3 pattern
- Created V3 logic files: ae_core__account.ts, ae_core__site.ts, ae_core__person.ts - Standardized on API -> Processor -> DB Save pattern - Added editable_fields definitions for Account, Site, Person, and Activity Log - Updated Activity Log module to use V3 wrappers - Updated Dexie schema with account, site, and site_domain tables - Added V3 tests to testing page
This commit is contained in:
@@ -120,6 +120,107 @@
|
||||
}
|
||||
|
||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||
import { load_ae_obj_li__account, load_ae_obj_id__account } from '$lib/ae_core/ae_core__account';
|
||||
import { load_ae_obj_li__site, load_ae_obj_id__site } from '$lib/ae_core/ae_core__site';
|
||||
import { load_ae_obj_li__person, load_ae_obj_id__person } from '$lib/ae_core/ae_core__person';
|
||||
|
||||
async function test_account_v3_load() {
|
||||
console.log('*** test_account_v3_load() ***');
|
||||
v3_test_result = 'loading...';
|
||||
|
||||
const account_li = await load_ae_obj_li__account({
|
||||
api_cfg: $ae_api,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
log_lvl: 2
|
||||
});
|
||||
|
||||
if (account_li && account_li.length > 0) {
|
||||
const first_account_id = account_li[0].account_id_random;
|
||||
console.log('Loading single account:', first_account_id);
|
||||
const account_obj = await load_ae_obj_id__account({
|
||||
api_cfg: $ae_api,
|
||||
account_id: first_account_id,
|
||||
log_lvl: 1
|
||||
});
|
||||
v3_test_result = {
|
||||
list_count: account_li.length,
|
||||
single_account: account_obj
|
||||
};
|
||||
} else {
|
||||
v3_test_result = 'No accounts found';
|
||||
}
|
||||
}
|
||||
|
||||
async function test_site_v3_load() {
|
||||
console.log('*** test_site_v3_load() ***');
|
||||
v3_test_result = 'loading...';
|
||||
|
||||
const account_id = $ae_loc.account_id;
|
||||
if (!account_id) {
|
||||
v3_test_result = 'No account_id found in $ae_loc';
|
||||
return;
|
||||
}
|
||||
|
||||
const site_li = await load_ae_obj_li__site({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_id: account_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
log_lvl: 2
|
||||
});
|
||||
|
||||
if (site_li && site_li.length > 0) {
|
||||
const first_site_id = site_li[0].site_id_random;
|
||||
const site_obj = await load_ae_obj_id__site({
|
||||
api_cfg: $ae_api,
|
||||
site_id: first_site_id,
|
||||
log_lvl: 2
|
||||
});
|
||||
v3_test_result = {
|
||||
account_id,
|
||||
list_count: site_li.length,
|
||||
single_site: site_obj
|
||||
};
|
||||
} else {
|
||||
v3_test_result = 'No sites found for account ' + account_id;
|
||||
}
|
||||
}
|
||||
|
||||
async function test_person_v3_load() {
|
||||
console.log('*** test_person_v3_load() ***');
|
||||
v3_test_result = 'loading...';
|
||||
|
||||
const account_id = $ae_loc.account_id;
|
||||
if (!account_id) {
|
||||
v3_test_result = 'No account_id found in $ae_loc';
|
||||
return;
|
||||
}
|
||||
|
||||
const person_li = await load_ae_obj_li__person({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_id: account_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
log_lvl: 2
|
||||
});
|
||||
|
||||
if (person_li && person_li.length > 0) {
|
||||
const first_person_id = person_li[0].person_id_random;
|
||||
const person_obj = await load_ae_obj_id__person({
|
||||
api_cfg: $ae_api,
|
||||
person_id: first_person_id,
|
||||
log_lvl: 2
|
||||
});
|
||||
v3_test_result = {
|
||||
account_id,
|
||||
list_count: person_li.length,
|
||||
single_person: person_obj
|
||||
};
|
||||
} else {
|
||||
v3_test_result = 'No persons found for account ' + account_id;
|
||||
}
|
||||
}
|
||||
|
||||
async function test_journal_module_soft_delete() {
|
||||
console.log('*** test_journal_module_soft_delete() ***');
|
||||
@@ -193,6 +294,15 @@
|
||||
<button class="btn variant-filled-success" onclick={test_journal_module_soft_delete}>
|
||||
Test Journal Module Soft Deletes
|
||||
</button>
|
||||
<button class="btn variant-filled-primary" onclick={test_account_v3_load}>
|
||||
Test Account V3 Load
|
||||
</button>
|
||||
<button class="btn variant-filled-secondary" onclick={test_site_v3_load}>
|
||||
Test Site V3 Load
|
||||
</button>
|
||||
<button class="btn variant-filled-tertiary" onclick={test_person_v3_load}>
|
||||
Test Person V3 Load
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user