Migrate Content and Storage modules to unified type system
- Added ae_HostedFile, ae_HostedFileLink, ae_DataStore, ae_Post, ae_PostComment, ae_Page, ae_Archive, and ae_ArchiveContent to ae_types.ts. - Replaced local interfaces in core__hosted_files.ts and core__data_store.ts with unified imports. - Replaced local interfaces in ae_archives/*.ts with unified imports. - Standardized Promise return types for all core data loading, creation, search, and update functions across migrated modules. - Synchronized storage and archival modules with Backend V3 field naming and Triple-ID patterns.
This commit is contained in:
@@ -3,6 +3,7 @@ import { api } from '$lib/api/api';
|
||||
|
||||
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||
import { db_archives } from '$lib/ae_archives/db_archives';
|
||||
import type { ae_Archive } from '$lib/types/ae_types';
|
||||
|
||||
import { load_ae_obj_li__archive_content } from '$lib/ae_archives/ae_archives__archive_content';
|
||||
|
||||
@@ -33,7 +34,7 @@ export async function load_ae_obj_id__archive({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Archive | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`);
|
||||
}
|
||||
@@ -123,11 +124,10 @@ export async function load_ae_obj_li__archive({
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Archive[]> {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
|
||||
@@ -208,7 +208,7 @@ export async function create_ae_obj__archive({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Archive | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** create_ae_obj__archive() *** account_id=${account_id}`);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ export async function update_ae_obj__archive({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Archive | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** update_ae_obj__archive() *** archive_id=${archive_id}`, data_kv);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ export async function qry__archive({
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_Archive[]> {
|
||||
const search_query: any = { and: [] };
|
||||
|
||||
if (account_id) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { api } from '$lib/api/api';
|
||||
|
||||
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
|
||||
import { db_archives } from '$lib/ae_archives/db_archives';
|
||||
import type { ae_ArchiveContent } from '$lib/types/ae_types';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
@@ -21,7 +22,7 @@ export async function load_ae_obj_id__archive_content({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_ArchiveContent | null> {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`
|
||||
@@ -95,11 +96,10 @@ export async function load_ae_obj_li__archive_content({
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'>;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_ArchiveContent[]> {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
|
||||
@@ -159,7 +159,7 @@ export async function create_ae_obj__archive_content({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_ArchiveContent | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** create_ae_obj__archive_content() *** archive_id=${archive_id}`);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ export async function update_ae_obj__archive_content({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_ArchiveContent | null> {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** update_ae_obj__archive_content() *** archive_content_id=${archive_content_id}`,
|
||||
|
||||
@@ -1,26 +1,7 @@
|
||||
import { browser } from '$app/environment';
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { api } from '$lib/api/api';
|
||||
|
||||
export interface Data_Store {
|
||||
id: string;
|
||||
account_id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
type: string;
|
||||
for_type?: string | null;
|
||||
for_id?: string | null;
|
||||
access_read?: string | null;
|
||||
access_write?: string | null;
|
||||
access_delete?: string | null;
|
||||
html?: string | null;
|
||||
json?: key_val | null;
|
||||
md?: string | null;
|
||||
text?: string | null;
|
||||
updated_on?: string | null;
|
||||
chk_account_id?: string;
|
||||
loaded_on?: string;
|
||||
}
|
||||
import type { ae_DataStore } from '$lib/types/ae_types';
|
||||
|
||||
/**
|
||||
* Fetches a data_store object by its unique code.
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { api } from '$lib/api/api';
|
||||
|
||||
import { db_core } from '$lib/ae_core/db_core';
|
||||
import type { ae_HostedFile } from '$lib/types/ae_types';
|
||||
|
||||
const ae_promises: key_val = {};
|
||||
|
||||
@@ -16,7 +17,7 @@ export async function load_ae_obj_id__hosted_file({
|
||||
hosted_file_id: string;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_HostedFile | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__hosted_file() *** hosted_file_id=${hosted_file_id}`);
|
||||
}
|
||||
@@ -78,7 +79,7 @@ export async function load_ae_obj_li__hosted_file({
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
}): Promise<ae_HostedFile[]> {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** load_ae_obj_li__hosted_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
|
||||
|
||||
@@ -93,6 +93,9 @@ export interface ae_Journal extends ae_BaseObj {
|
||||
journal_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
journal_entry_count?: number;
|
||||
file_count?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -475,3 +478,135 @@ export interface ae_EventTrack extends ae_BaseObj {
|
||||
start_datetime?: string | Date;
|
||||
end_datetime?: string | Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* HostedFile - A file stored on the system
|
||||
*/
|
||||
export interface ae_HostedFile extends ae_BaseObj {
|
||||
hosted_file_id: string;
|
||||
hosted_file_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
hash_sha256?: string;
|
||||
subdirectory_path?: string;
|
||||
filename?: string;
|
||||
extension?: string;
|
||||
mimetype?: string;
|
||||
size?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* HostedFileLink - A many-to-many link between objects and files
|
||||
*/
|
||||
export interface ae_HostedFileLink {
|
||||
id: string;
|
||||
account_id_random: string;
|
||||
hosted_file_id_random: string;
|
||||
link_to_type: string;
|
||||
link_to_id_random: string;
|
||||
|
||||
created_on: string | Date;
|
||||
updated_on: string | Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* DataStore - Generic JSON/Text storage
|
||||
*/
|
||||
export interface ae_DataStore extends ae_BaseObj {
|
||||
data_store_id: string;
|
||||
data_store_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
for_type?: string;
|
||||
for_id_random?: string;
|
||||
|
||||
type?: string;
|
||||
json_str?: any;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post - A message board entry
|
||||
*/
|
||||
export interface ae_Post extends ae_BaseObj {
|
||||
post_id: string;
|
||||
post_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
title: string;
|
||||
content: string;
|
||||
type?: string;
|
||||
|
||||
anonymous: boolean;
|
||||
full_name?: string;
|
||||
email?: string;
|
||||
|
||||
post_comment_count?: number;
|
||||
approve?: boolean;
|
||||
ready?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* PostComment - A reply to a post
|
||||
*/
|
||||
export interface ae_PostComment extends ae_BaseObj {
|
||||
post_comment_id: string;
|
||||
post_comment_id_random: string;
|
||||
post_id_random: string;
|
||||
|
||||
content: string;
|
||||
anonymous: boolean;
|
||||
full_name?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page - A custom CMS page
|
||||
*/
|
||||
export interface ae_Page extends ae_BaseObj {
|
||||
page_id: string;
|
||||
page_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
alias: string;
|
||||
title: string;
|
||||
body: string;
|
||||
authentication_required: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Archive - A collection of archival content
|
||||
*/
|
||||
export interface ae_Archive extends ae_BaseObj {
|
||||
archive_id: string;
|
||||
archive_id_random: string;
|
||||
account_id: string;
|
||||
account_id_random: string;
|
||||
|
||||
archive_type?: string;
|
||||
content_html?: string;
|
||||
|
||||
original_datetime?: string | Date;
|
||||
original_location?: string;
|
||||
|
||||
archive_content_count?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* ArchiveContent - A discrete item within an archive
|
||||
*/
|
||||
export interface ae_ArchiveContent extends ae_BaseObj {
|
||||
archive_content_id: string;
|
||||
archive_content_id_random: string;
|
||||
archive_id_random: string;
|
||||
|
||||
archive_content_type?: string;
|
||||
content_html?: string;
|
||||
url?: string;
|
||||
|
||||
hosted_file_id_random?: string;
|
||||
filename?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user