Forgot to save my work earlier...?

This commit is contained in:
Scott Idem
2025-01-15 22:05:41 -05:00
parent 6f11820857
commit 8b309d7b04
4 changed files with 100 additions and 127 deletions

View File

@@ -14,7 +14,7 @@ let ae_promises: key_val = {}; // Promise<any>;
// Updated 2024-03-29
async function handle_load_ae_obj_id__sponsorship_cfg(
async function load_ae_obj_id__sponsorship_cfg(
{
api_cfg,
sponsorship_cfg_id,
@@ -28,7 +28,7 @@ async function handle_load_ae_obj_id__sponsorship_cfg(
}
) {
if (log_lvl) {
console.log(`*** handle_load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`);
console.log(`*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`);
}
let params = {};
@@ -51,9 +51,9 @@ async function handle_load_ae_obj_id__sponsorship_cfg(
}
if (try_cache) {
// This is expecting a list
db_save_ae_obj_li__sponsorship({
obj_type: 'sponsorship',
obj_li: [sponsorship_obj_get_result]
db_save_ae_obj_li__sponsorship_cfg({
obj_type: 'sponsorship_cfg',
obj_li: [sponsorship_cfg_obj_get_result]
});
}
return sponsorship_cfg_obj_get_result;
@@ -74,6 +74,66 @@ async function handle_load_ae_obj_id__sponsorship_cfg(
}
// Updated 2024-03-29
async function load_ae_obj_id__sponsorship(
{
api_cfg,
sponsorship_id,
try_cache = false,
log_lvl = 0
}: {
api_cfg: any,
sponsorship_id: string,
try_cache: boolean,
log_lvl: number
}
) {
if (log_lvl) {
console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
}
let params = {};
ae_promises.load__sponsorship_obj = api.get_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'sponsorship',
obj_id: sponsorship_id,
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
params: params,
log_lvl: log_lvl
})
.then(function (sponsorship_obj_get_result) {
if (sponsorship_obj_get_result) {
if (log_lvl) {
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`);
} else if (log_lvl > 1) {
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`, sponsorship_obj_get_result);
}
if (try_cache) {
// This is expecting a list
db_save_ae_obj_li__sponsorship({
obj_type: 'sponsorship',
obj_li: [sponsorship_obj_get_result]
});
}
return sponsorship_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
if (log_lvl) {
console.log('ae_promises.load__sponsorship_obj:', ae_promises.load__sponsorship_obj);
}
return ae_promises.load__sponsorship_obj;
}
// Updated 2025-01-15
async function load_ae_obj_li__sponsorship(
{
@@ -285,7 +345,8 @@ export function db_save_ae_obj_li__sponsorship(
let export_obj = {
handle_load_ae_obj_id__sponsorship_cfg: handle_load_ae_obj_id__sponsorship_cfg,
load_ae_obj_id__sponsorship_cfg: load_ae_obj_id__sponsorship_cfg,
load_ae_obj_id__sponsorship: load_ae_obj_id__sponsorship,
load_ae_obj_li__sponsorship: load_ae_obj_li__sponsorship,
handle_download_export__sponsorship: handle_download_export__sponsorship,
db_save_ae_obj_li__sponsorship: db_save_ae_obj_li__sponsorship

View File

@@ -5,7 +5,7 @@ import type { key_val } from '../ae_stores';
// li = list
// kv = key value list
// Updated 202-01-15
// Updated 2025-01-15
export interface Sponsorship {
id: string;
// id_random: string;
@@ -74,49 +74,43 @@ export interface Sponsorship {
}
// // Updated 2024-11-13
// export interface Sponsorship_Comment {
// id: string;
// // id_random: string;
// sponsorship_comment_id: string;
// // sponsorship_comment_id_random: string;
// Updated 2025-01-15
export interface Sponsorship_Cfg {
id: string;
// id_random: string;
sponsorship_cfg_id: string;
// sponsorship_cfg_id_random: string;
// sponsorship_id: string;
// // sponsorship_id_random: string;
account_id: string;
// account_id_random: string;
// external_person_id?: null|string; // For IDAA this is the Novi UUID
for_type?: null|string;
for_id?: null|number;
// name: null|string;
// title: null|string;
// // summary?: null|string;
// content?: null|string;
level_li_json?: null|string;
option_li_json?: null|string;
schedule_li_json?: null|string;
// anonymous?: null|boolean;
// full_name?: null|string;
// email?: null|string;
// notify?: null|boolean;
cfg_json?: null|key_val;
// linked_li_json?: null|string;
// cfg_json?: null|key_val;
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;
// 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;
// // Additional fields for convenience (database views)
// }
// Additional fields for convenience (database views)
}
// Updated 2024-09-25
export class MySubClassedDexie extends Dexie {
// We just tell the typing system this is the case
sponsorship!: Table<Sponsorship>;
// comment!: Table<Sponsorship_Comment>;
cfg!: Table<Sponsorship_Cfg>;
constructor() {
super('ae_sponsorships_db');
@@ -129,7 +123,12 @@ export class MySubClassedDexie extends Dexie {
level_num, level_str, amount,
agree,
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on], [created_on+updated_on]`,
});
cfg: `
id, sponsorship_cfg_id,
account_id,
for_type, for_id`,
});
}
}