feat(v3): harden clean ID pattern and standardize snake_case platform-wide

- Systematically migrated from *_id_random to clean *_id fields in BB, People, and Posts modules.
- Synchronized Post_Comment interface with account_id for multi-tenant isolation.
- Applied optional chaining and local reactive state to harden async UI initialization.
- Refactored common helpers to follow snake_case naming conventions.
- Resolved various minor stability and logic issues across IDAA Bulletin Board.
This commit is contained in:
Scott Idem
2026-02-06 10:44:26 -05:00
parent 7401003614
commit 49e1d57f8f
8 changed files with 37 additions and 41 deletions

View File

@@ -38,7 +38,7 @@
let prom_api__post_comment_obj: any = $state();
// SVELTE 5 STABILITY: Use local state for form bindings to prevent
// SVELTE 5 STABILITY: Use local state for form bindings to prevent
// crashes when the global store object is briefly null.
let post_comment_form = $state({
content: $idaa_slct.post_comment_obj?.content ?? '',
@@ -109,7 +109,7 @@
// NEW COMMENT: Ensure post_id is included
const parent_post_id = $idaa_slct.post_id;
post_comment_do['post_id'] = parent_post_id;
// post_comment_do['post_id_random'] = parent_post_id;
// post_comment_do['post_id'] = parent_post_id;
}
log_lvl = 1;
@@ -118,10 +118,10 @@
}
if (!$idaa_slct.post_comment_id) {
// NEW COMMENT: Ensure post_id_random is included
// NEW COMMENT: Ensure post_id is included
// SVELTE 5 V3 Pattern: Some child objects require the random ID suffix for parent mapping
post_comment_do['post_id_random'] = $idaa_slct.post_id;
post_comment_do['post_id'] = $idaa_slct.post_id;
if (log_lvl) {
console.log(
`Current Post Comment Object List Length: ${$idaa_slct.post_comment_obj_li.length}`,
@@ -144,7 +144,7 @@
});
if (prom_api__post_comment_obj) {
$idaa_slct.post_comment_id = prom_api__post_comment_obj.post_comment_id_random;
$idaa_slct.post_comment_id = prom_api__post_comment_obj.post_comment_id;
$idaa_slct.post_comment_obj = prom_api__post_comment_obj;
disable_submit_btn = false;

View File

@@ -184,7 +184,7 @@
if (log_lvl) {
console.log('post_obj_create_result:', post_obj_create_result);
}
$idaa_slct.post_id = post_obj_create_result.post_id_random;
$idaa_slct.post_id = post_obj_create_result.post_id;
$idaa_slct.post_obj = post_obj_create_result;
return post_obj_create_result;
@@ -570,11 +570,11 @@ Copy and paste link: <a href="${link_base_url}?post_id=${$idaa_slct.post_id}">${
>
<span class="fas fa-paperclip m-1"></span>
{linked_obj.filename}
({linked_obj.hosted_file_id_random})
({linked_obj.hosted_file_id})
</a> -->
{#if $ae_loc.authenticated_access}
{@const file_id = linked_obj?.hosted_file_id_random || linked_obj?.id || linked_obj?.hosted_file_id}
{@const file_id = linked_obj?.hosted_file_id || linked_obj?.id || linked_obj?.hosted_file_id}
{#if file_id}
{@const ext = (linked_obj.extension || linked_obj.file_extension || ae_util.guess_file_extension(linked_obj.filename) || '').toLowerCase()}
{#if ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg'].includes(ext)}
@@ -608,7 +608,7 @@ Copy and paste link: <a href="${link_base_url}?post_id=${$idaa_slct.post_id}">${
return false;
}
// ae_promises[linked_obj.event_file_id_random] = handle_delete__event_file({event_file_id: linked_obj.event_file_id_random});
// ae_promises[linked_obj.event_file_id] = handle_delete__event_file({event_file_id: linked_obj.event_file_id});
// First - Attempt to delete the hosted file
ae_promises.delete__linked_obj = await core_func
@@ -631,7 +631,7 @@ Copy and paste link: <a href="${link_base_url}?post_id=${$idaa_slct.post_id}">${
let delete_result_li =
$idaa_slct.post_obj.linked_li_json.filter(
function (hosted_file_obj) {
const current_id = hosted_file_obj?.hosted_file_id_random || hosted_file_obj?.id || hosted_file_obj?.hosted_file_id;
const current_id = hosted_file_obj?.hosted_file_id || hosted_file_obj?.id || hosted_file_obj?.hosted_file_id;
console.log(
`Comparing: ${current_id} vs ${file_id}`
);

View File

@@ -248,11 +248,11 @@
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid}
<button type="button"
onclick={() => {
// $idaa_slct.post_id = $idaa_slct.post_obj.post_id_random;
// $idaa_slct.post_id = $idaa_slct.post_obj.post_id;
$idaa_slct.post_obj = $lq__post_obj; // In case things changed
// const url = new URL(location);
// url.searchParams.set('post_id', $idaa_slct.post_obj.post_id_random);
// url.searchParams.set('post_id', $idaa_slct.post_obj.post_id);
// history.pushState({}, '', url);
// $idaa_sess.bb.show_main__options = false;