Migrate Address and Contact modules to unified type system
- Added ae_Address and ae_Contact interfaces to ae_types.ts. - Replaced local interfaces in Address and Contact logic files with unified imports. - Standardized Promise return types for all core data loading, creation, and update functions in migrated modules. - Refined field optionality to align with frontend CRUD requirements.
This commit is contained in:
@@ -3,33 +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_Address } from '$lib/types/ae_types';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
export interface Address {
|
||||
id: string;
|
||||
address_id: string;
|
||||
address_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
for_type?: string;
|
||||
for_id?: string;
|
||||
for_id_random?: string;
|
||||
|
||||
city: string;
|
||||
state_province: string;
|
||||
country: 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;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function load_ae_obj_id__address({
|
||||
api_cfg,
|
||||
@@ -45,7 +22,7 @@ export async function load_ae_obj_id__address({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Address | null> {
|
||||
ae_promises.load__address_obj = await api.get_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
@@ -94,10 +71,10 @@ export async function load_ae_obj_li__address({
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Address[]> {
|
||||
ae_promises.load__address_obj_li = await api.get_ae_obj_li_v3({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
@@ -144,7 +121,7 @@ export async function create_ae_obj__address({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Address | null> {
|
||||
const result = await api.create_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
@@ -184,7 +161,7 @@ export async function update_ae_obj__address({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Address | null> {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'address',
|
||||
|
||||
@@ -3,33 +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_Contact } from '$lib/types/ae_types';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
export interface Contact {
|
||||
id: string;
|
||||
contact_id: string;
|
||||
contact_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
for_type?: string;
|
||||
for_id?: string;
|
||||
for_id_random?: string;
|
||||
|
||||
name: string;
|
||||
email: string;
|
||||
phone: 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;
|
||||
}
|
||||
|
||||
// Updated 2026-01-06
|
||||
export async function load_ae_obj_id__contact({
|
||||
api_cfg,
|
||||
@@ -45,7 +22,7 @@ export async function load_ae_obj_id__contact({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Contact | null> {
|
||||
ae_promises.load__contact_obj = await api.get_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
@@ -97,7 +74,7 @@ export async function load_ae_obj_li__contact({
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Contact[]> {
|
||||
ae_promises.load__contact_obj_li = await api.get_ae_obj_li_v3({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
@@ -144,7 +121,7 @@ export async function create_ae_obj__contact({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Contact | null> {
|
||||
const result = await api.create_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
@@ -184,7 +161,7 @@ export async function update_ae_obj__contact({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Contact | null> {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'contact',
|
||||
|
||||
Reference in New Issue
Block a user