Migrate Person and Site modules to unified type system
- Updated ae_types.ts with detailed fields for ae_Person, ae_Site, and ae_SiteDomain based on V3 backend exports. - Replaced local interfaces in ae_core__person.ts and ae_core__site.ts with unified imports. - Added explicit Promise return types to all core data loading and CRUD functions in Person and Site modules. - Standardized triple-ID pattern and return signatures across core identity and configuration modules.
This commit is contained in:
@@ -3,88 +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_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||||
import { db_core } from '$lib/ae_core/db_core';
|
import { db_core } from '$lib/ae_core/db_core';
|
||||||
|
import type { ae_Person } from '$lib/types/ae_types';
|
||||||
|
|
||||||
const ae_promises: key_val = {};
|
const ae_promises: key_val = {};
|
||||||
|
|
||||||
export interface Person {
|
|
||||||
id: string;
|
|
||||||
person_id: string;
|
|
||||||
person_id_random: string;
|
|
||||||
|
|
||||||
external_id?: string;
|
|
||||||
external_sys_id?: string;
|
|
||||||
code?: string;
|
|
||||||
|
|
||||||
account_id?: string;
|
|
||||||
account_id_random?: string;
|
|
||||||
|
|
||||||
person_profile_id?: null | string;
|
|
||||||
person_profile_id_random?: null | string;
|
|
||||||
|
|
||||||
user_id?: string;
|
|
||||||
user_id_random?: string;
|
|
||||||
|
|
||||||
pronouns?: null | string;
|
|
||||||
informal_name?: null | string;
|
|
||||||
title_names?: null | string;
|
|
||||||
given_name: string;
|
|
||||||
middle_name?: null | string;
|
|
||||||
family_name: null | string;
|
|
||||||
designations?: null | string;
|
|
||||||
|
|
||||||
professional_title?: null | string;
|
|
||||||
|
|
||||||
full_name?: string;
|
|
||||||
full_name_override?: null | string;
|
|
||||||
|
|
||||||
affiliations?: null | string;
|
|
||||||
|
|
||||||
primary_email?: string;
|
|
||||||
|
|
||||||
biography?: null | string;
|
|
||||||
|
|
||||||
agree?: null | boolean;
|
|
||||||
comments?: null | string;
|
|
||||||
|
|
||||||
allow_auth_key?: null | boolean;
|
|
||||||
auth_key?: null | string;
|
|
||||||
passcode?: null | string;
|
|
||||||
|
|
||||||
data_json?: null | string;
|
|
||||||
|
|
||||||
enable: null | boolean;
|
|
||||||
hide?: null | boolean;
|
|
||||||
priority?: null | boolean;
|
|
||||||
sort?: null | number;
|
|
||||||
group?: null | string;
|
|
||||||
notes?: null | string;
|
|
||||||
created_on: Date;
|
|
||||||
updated_on?: null | Date;
|
|
||||||
|
|
||||||
tmp_sort_1?: string;
|
|
||||||
tmp_sort_2?: string;
|
|
||||||
tmp_sort_3?: string;
|
|
||||||
|
|
||||||
// View fields
|
|
||||||
username?: string;
|
|
||||||
user_name?: null | string;
|
|
||||||
user_email?: null | string;
|
|
||||||
user_allow_auth_key?: null | boolean;
|
|
||||||
user_super?: boolean;
|
|
||||||
user_manager?: boolean;
|
|
||||||
user_administrator?: boolean;
|
|
||||||
user_public?: boolean;
|
|
||||||
|
|
||||||
organization_id?: null | string;
|
|
||||||
organization_id_random?: null | string;
|
|
||||||
organization_name?: null | string;
|
|
||||||
|
|
||||||
contact_id?: null | string;
|
|
||||||
contact_id_random?: null | string;
|
|
||||||
contact_name?: null | string;
|
|
||||||
contact_email?: null | string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Updated 2026-01-06
|
// Updated 2026-01-06
|
||||||
export async function load_ae_obj_id__person({
|
export async function load_ae_obj_id__person({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
@@ -100,7 +22,7 @@ export async function load_ae_obj_id__person({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Person | null> {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** load_ae_obj_id__person() *** person_id=${person_id}`);
|
console.log(`*** load_ae_obj_id__person() *** person_id=${person_id}`);
|
||||||
}
|
}
|
||||||
@@ -172,7 +94,7 @@ export async function load_ae_obj_li__person({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Person[]> {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** load_ae_obj_li__person() *** for_obj_id=${for_obj_id}`);
|
console.log(`*** load_ae_obj_li__person() *** for_obj_id=${for_obj_id}`);
|
||||||
}
|
}
|
||||||
@@ -270,7 +192,7 @@ export async function create_ae_obj__person({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Person | null> {
|
||||||
const fields: key_val = { ...data_kv };
|
const fields: key_val = { ...data_kv };
|
||||||
if (account_id) fields.account_id_random = account_id;
|
if (account_id) fields.account_id_random = account_id;
|
||||||
if (user_id) fields.user_id_random = user_id;
|
if (user_id) fields.user_id_random = user_id;
|
||||||
@@ -315,7 +237,7 @@ export async function update_ae_obj__person({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Person | null> {
|
||||||
const result = await api.update_ae_obj_v3({
|
const result = await api.update_ae_obj_v3({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
obj_type: 'person',
|
obj_type: 'person',
|
||||||
|
|||||||
@@ -3,75 +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_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||||
import { db_core } from '$lib/ae_core/db_core';
|
import { db_core } from '$lib/ae_core/db_core';
|
||||||
|
import type { ae_Site, ae_SiteDomain } from '$lib/types/ae_types';
|
||||||
|
|
||||||
const ae_promises: key_val = {};
|
const ae_promises: key_val = {};
|
||||||
|
|
||||||
export interface Site {
|
|
||||||
id: string;
|
|
||||||
site_id: string;
|
|
||||||
site_id_random: string;
|
|
||||||
account_id: string;
|
|
||||||
account_id_random: string;
|
|
||||||
|
|
||||||
code?: string;
|
|
||||||
name: string;
|
|
||||||
description?: null | string;
|
|
||||||
|
|
||||||
restrict_access?: null | boolean;
|
|
||||||
access_key?: null | string;
|
|
||||||
access_code_kv_json?: null | string;
|
|
||||||
|
|
||||||
logo_path?: null | string;
|
|
||||||
logo_bg_color?: null | string;
|
|
||||||
title?: null | string;
|
|
||||||
tagline?: null | string;
|
|
||||||
style_href?: null | string;
|
|
||||||
google_tracking_id?: null | string;
|
|
||||||
|
|
||||||
cfg_json?: 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;
|
|
||||||
|
|
||||||
tmp_sort_1?: string;
|
|
||||||
tmp_sort_2?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Site_Domain {
|
|
||||||
id: string;
|
|
||||||
site_domain_id: string;
|
|
||||||
site_domain_id_random: string;
|
|
||||||
site_id: string;
|
|
||||||
site_id_random: string;
|
|
||||||
|
|
||||||
fqdn: string;
|
|
||||||
access_key?: 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;
|
|
||||||
|
|
||||||
tmp_sort_1?: string;
|
|
||||||
tmp_sort_2?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --- SITE CRUD ---
|
* --- SITE CRUD ---
|
||||||
*/
|
*/
|
||||||
@@ -86,7 +21,7 @@ export async function lookup_site_domain({
|
|||||||
fqdn: string;
|
fqdn: string;
|
||||||
view?: string;
|
view?: string;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_SiteDomain | null> {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** lookup_site_domain() *** fqdn=${fqdn}`);
|
console.log(`*** lookup_site_domain() *** fqdn=${fqdn}`);
|
||||||
}
|
}
|
||||||
@@ -121,7 +56,7 @@ export async function lookup_site_domain_v3({
|
|||||||
fqdn: string;
|
fqdn: string;
|
||||||
view?: string;
|
view?: string;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_SiteDomain | null> {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** lookup_site_domain_v3() *** fqdn=${fqdn}`);
|
console.log(`*** lookup_site_domain_v3() *** fqdn=${fqdn}`);
|
||||||
}
|
}
|
||||||
@@ -186,7 +121,7 @@ export async function load_ae_obj_id__site({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Site | null> {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** load_ae_obj_id__site() *** site_id=${site_id}`);
|
console.log(`*** load_ae_obj_id__site() *** site_id=${site_id}`);
|
||||||
}
|
}
|
||||||
@@ -257,7 +192,7 @@ export async function load_ae_obj_li__site({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Site[]> {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`*** load_ae_obj_li__site() *** for_obj_id=${for_obj_id}`);
|
console.log(`*** load_ae_obj_li__site() *** for_obj_id=${for_obj_id}`);
|
||||||
}
|
}
|
||||||
@@ -315,7 +250,7 @@ export async function create_ae_obj__site({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Site | null> {
|
||||||
const result = await api.create_ae_obj_v3({
|
const result = await api.create_ae_obj_v3({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
obj_type: 'site',
|
obj_type: 'site',
|
||||||
@@ -359,7 +294,7 @@ export async function update_ae_obj__site({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_Site | null> {
|
||||||
const result = await api.update_ae_obj_v3({
|
const result = await api.update_ae_obj_v3({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
obj_type: 'site',
|
obj_type: 'site',
|
||||||
@@ -447,7 +382,7 @@ export async function load_ae_obj_li__site_domain({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_SiteDomain[]> {
|
||||||
ae_promises.load__site_domain_li = await api
|
ae_promises.load__site_domain_li = await api
|
||||||
.get_nested_obj_li_v3({
|
.get_nested_obj_li_v3({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
@@ -502,7 +437,7 @@ export async function create_ae_obj__site_domain({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_SiteDomain | null> {
|
||||||
const result = await api.create_nested_obj_v3({
|
const result = await api.create_nested_obj_v3({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
parent_type: 'site',
|
parent_type: 'site',
|
||||||
@@ -548,7 +483,7 @@ export async function update_ae_obj__site_domain({
|
|||||||
params?: key_val;
|
params?: key_val;
|
||||||
try_cache?: boolean;
|
try_cache?: boolean;
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
}) {
|
}): Promise<ae_SiteDomain | null> {
|
||||||
const result = await api.update_nested_obj_v3({
|
const result = await api.update_nested_obj_v3({
|
||||||
api_cfg,
|
api_cfg,
|
||||||
parent_type: 'site',
|
parent_type: 'site',
|
||||||
|
|||||||
@@ -54,6 +54,17 @@ export interface ae_Site extends ae_BaseObj {
|
|||||||
|
|
||||||
url_root?: string;
|
url_root?: string;
|
||||||
site_cfg_json?: any;
|
site_cfg_json?: any;
|
||||||
|
|
||||||
|
restrict_access?: boolean;
|
||||||
|
access_key?: string;
|
||||||
|
|
||||||
|
logo_path?: string;
|
||||||
|
logo_bg_color?: string;
|
||||||
|
background_image_path?: string;
|
||||||
|
background_bg_color?: string;
|
||||||
|
|
||||||
|
title?: string;
|
||||||
|
tagline?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,10 +75,14 @@ export interface ae_SiteDomain extends ae_BaseObj {
|
|||||||
site_domain_id_random: string;
|
site_domain_id_random: string;
|
||||||
site_id: string;
|
site_id: string;
|
||||||
site_id_random: string;
|
site_id_random: string;
|
||||||
|
account_id?: string;
|
||||||
|
account_id_random?: string;
|
||||||
|
|
||||||
fqdn: string;
|
fqdn: string;
|
||||||
is_primary: boolean;
|
is_primary?: boolean;
|
||||||
redirect_to_primary: boolean;
|
redirect_to_primary?: boolean;
|
||||||
|
|
||||||
|
access_key?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,10 +152,31 @@ export interface ae_Person extends ae_BaseObj {
|
|||||||
person_id_random: string;
|
person_id_random: string;
|
||||||
account_id: string;
|
account_id: string;
|
||||||
account_id_random: string;
|
account_id_random: string;
|
||||||
|
|
||||||
|
user_id?: string;
|
||||||
|
user_id_random?: string;
|
||||||
|
|
||||||
first_name?: string;
|
prefix?: string;
|
||||||
last_name?: string;
|
given_name?: string;
|
||||||
|
middle_name?: string;
|
||||||
|
family_name?: string;
|
||||||
|
suffix?: string;
|
||||||
|
|
||||||
full_name?: string;
|
full_name?: string;
|
||||||
|
informal_name?: string;
|
||||||
|
preferred_display_name?: string;
|
||||||
|
|
||||||
|
professional_title?: string;
|
||||||
|
affiliations?: string;
|
||||||
|
|
||||||
|
primary_email?: string;
|
||||||
email?: string;
|
email?: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
}
|
|
||||||
|
birth_date?: string | Date;
|
||||||
|
gender_name?: string;
|
||||||
|
|
||||||
|
tagline?: string;
|
||||||
|
|
||||||
|
data_json?: any;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user