The initial migration for IDAA Recovery Meetings. Progress

This commit is contained in:
Scott Idem
2024-09-27 15:20:26 -04:00
parent 495dd0e6d9
commit d6c26e7511
21 changed files with 787 additions and 453 deletions

View File

@@ -67,11 +67,12 @@ export async function handle_load_ae_obj_id__event(
}
// Updated 2024-05-24
export async function handle_load_ae_obj_li__event(
// Updated 2024-09-27
export async function load_ae_obj_li__event(
{
api_cfg,
account_id,
for_obj_type = 'account',
for_obj_id,
inc_file_li = false,
inc_location_li = false,
inc_presentation_li = false,
@@ -83,7 +84,8 @@ export async function handle_load_ae_obj_li__event(
log_lvl = 0
}: {
api_cfg: any,
account_id: string,
for_obj_type: string,
for_obj_id: string,
inc_file_li?: boolean,
inc_location_li?: boolean,
inc_presentation_li?: boolean,
@@ -95,7 +97,7 @@ export async function handle_load_ae_obj_li__event(
log_lvl?: number
}
) {
console.log(`*** handle_load_ae_obj_li__event() *** account_id=${account_id}`);
console.log(`*** load_ae_obj_li__event() *** for_obj_id=${for_obj_id}`);
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
@@ -110,8 +112,8 @@ export async function handle_load_ae_obj_li__event(
ae_promises.load__event_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'event',
for_obj_type: 'account',
for_obj_id: account_id,
for_obj_type: for_obj_type,
for_obj_id: for_obj_id,
use_alt_table: true, // 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
enabled: enabled,
@@ -316,6 +318,23 @@ export function handle_db_save_ae_obj_li__event(
created_on: obj.created_on,
updated_on: obj.updated_on,
// IDAA Recovery Meetings
contact_li_json: obj.contact_li_json,
external_person_id: obj.external_person_id,
physical: obj.physical,
virtual: obj.virtual,
weekday_sunday: obj.weekday_sunday,
weekday_monday: obj.weekday_monday,
weekday_tuesday: obj.weekday_tuesday,
weekday_wednesday: obj.weekday_wednesday,
weekday_thursday: obj.weekday_thursday,
weekday_friday: obj.weekday_friday,
weekday_saturday: obj.weekday_saturday,
recurring_start_time: obj.recurring_start_time,
// From SQL view
file_count: obj.file_count,
file_count_all: obj.file_count_all,

View File

@@ -2,7 +2,7 @@
import {
handle_load_ae_obj_id__event,
handle_load_ae_obj_li__event,
load_ae_obj_li__event,
create_ae_obj__event,
update_ae_obj__event,
handle_db_save_ae_obj_li__event,
@@ -78,7 +78,7 @@ import {
let export_obj = {
handle_load_ae_obj_id__event: handle_load_ae_obj_id__event,
handle_load_ae_obj_li__event: handle_load_ae_obj_li__event,
load_ae_obj_li__event: load_ae_obj_li__event,
create_ae_obj__event: create_ae_obj__event,
update_ae_obj__event: update_ae_obj__event,
handle_db_save_ae_obj_li__event: handle_db_save_ae_obj_li__event,

113
src/lib/ae_idaa_stores.ts Normal file
View File

@@ -0,0 +1,113 @@
import { localStorageStore } from '@skeletonlabs/skeleton';
import { writable } from 'svelte/store';
import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/ae_stores';
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2024-08-21_1646';
let ver_idb = '2024-08-21_1645';
/* *** BEGIN *** Initialize idaa_local_data_struct */
// Longer-term app data. This should be stored to *local* storage.
// Updated 2024-03-06
let idaa_local_data_struct: key_val = {
ver: ver,
ver_idb: ver_idb,
// Shared
name: 'Aether - IDAA (SvelteKit 2.x Svelte 4.x)',
title: `OSIT's Æ IDAA`, // - Dev SvelteKit`, // Æ
'ds': {},
'idaa_cfg_json': {},
// all, disabled, enabled
'qry__enabled': 'enabled',
// all, hidden, not_hidden
'qry__hidden': 'not_hidden',
'qry__limit': 20,
'qry__offset': 0,
archives: {
},
posts: {
},
recovery_meetings: {
},
};
// console.log(`AE Stores - App IDAA Local Storage Data:`, idaa_local_data_struct);
// This works, but does not uses local storage:
// export let ae_loc = writable(idaa_local_data_struct);
// This works and uses *local* storage:
export let idaa_loc: Writable<key_val> = localStorageStore('ae_idaa_loc', idaa_local_data_struct);
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
/* *** BEGIN *** Initialize idaa_session_data_struct */
// Temporary app data. This should be stored to session storage.
// Updated 2024-03-06
let idaa_session_data_struct: key_val = {
ver: ver,
ver_idb: ver_idb,
log_lvl: 1,
archives: {
},
posts: {
},
recovery_meetings: {
},
};
// console.log(`AE Stores - App IDAA Session Storage Data:`, idaa_session_data_struct);
export let idaa_sess = writable(idaa_session_data_struct);
/* *** BEGIN *** Initialize idaa_slct and idaa_trigger */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different idaa, badges, exhibits, etc. */
// Intended for temporary session storage.
// Updated 2024-03-06
let idaa_slct_obj_template: key_val = {
// Top level
'event_id': null,
'event_obj': {},
'event_obj_li': [],
'archive_id': null,
'archive_obj': {},
'archive_obj_li': [],
'archive_content_id': null,
'archive_content_obj': {},
'archive_content_obj_li': [],
'post_id': null,
'post_obj': {},
'post_obj_li': [],
'post_comment_id': null,
'post_comment_obj': {},
'post_comment_obj_li': [],
};
// console.log(`AE Stores - Selected IDAA Objects:`, idaa_slct_obj_template);
// This works, and uses *session* (not local) storage:
export let idaa_slct = writable(idaa_slct_obj_template);
// This works and uses *local* storage:
// export let idaa_slct: Writable<key_val> = localStorageStore('ae_idaa_slct', idaa_slct_obj_template);

View File

@@ -42,6 +42,23 @@ export interface Event {
created_on: Date;
updated_on: null|Date;
// IDAA Recovery Meetings
contact_li_json?: null|string[]; // full_name, email, phone_mobile, phone_home, phone_office, other_text
external_person_id?: null|string;
physical?: null|boolean;
virtual?: null|boolean;
weekday_sunday?: null|boolean;
weekday_monday?: null|boolean;
weekday_tuesday?: null|boolean;
weekday_wednesday?: null|boolean;
weekday_thursday?: null|boolean;
weekday_friday?: null|boolean;
weekday_saturday?: null|boolean;
recurring_start_time?: null|string;
// Additional fields for convenience (database views)
file_count?: null|number;
file_count_all?: null|number;