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

@@ -107,18 +107,18 @@
log_lvl: 1
});
// Filter users that don't have a person_id linked
// NOTE: The backend might return person_id or person_id_random
available_users = all_users.filter(u => !u.person_id_random && !u.person_id);
// NOTE: The backend might return person_id or person_id
available_users = all_users.filter(u => !u.person_id && !u.person_id);
loading_users = false;
}
async function handle_link_user(user_id_random: string) {
async function handle_link_user(user_id: string) {
if (!confirm('Link this person to this user account?')) return;
const result = await update_ae_obj__person({
api_cfg: $ae_api,
person_id: $slct.person_id,
data_kv: { user_id_random },
data_kv: { user_id },
log_lvl: 1
});
@@ -134,7 +134,7 @@
const result = await update_ae_obj__person({
api_cfg: $ae_api,
person_id: $slct.person_id,
data_kv: { user_id_random: null },
data_kv: { user_id: null },
log_lvl: 1
});
}
@@ -252,7 +252,7 @@
<ShieldCheck size={18} />
<span>User Account Linking</span>
</div>
{#if $lq__person_obj?.user_id_random}
{#if $lq__person_obj?.user_id}
<button class="btn btn-sm variant-soft-error" onclick={handle_unlink_user}>
<Unlink size={14} class="mr-2" /> Unlink User
</button>
@@ -266,14 +266,14 @@
{/if}
</header>
{#if $lq__person_obj?.user_id_random}
{#if $lq__person_obj?.user_id}
<div class="flex items-center gap-4 py-2">
<div class="avatar variant-filled-primary w-12 h-12 flex items-center justify-center rounded-full">
<Users size={24} />
</div>
<div>
<p class="text-sm opacity-60 uppercase tracking-widest font-bold">Linked User ID</p>
<p class="font-mono text-lg">{$lq__person_obj.user_id_random}</p>
<p class="font-mono text-lg">{$lq__person_obj.user_id}</p>
<p class="text-xs opacity-60">Username: {$lq__person_obj.username || '--'}</p>
</div>
</div>
@@ -289,7 +289,7 @@
{#each available_users as user}
<button
class="card p-3 variant-soft-primary hover:variant-filled-primary text-left transition-all flex flex-col gap-1"
onclick={() => handle_link_user(user.user_id_random)}
onclick={() => handle_link_user(user.user_id)}
>
<span class="font-bold flex items-center gap-2">
<User size={14} />
@@ -333,7 +333,7 @@
{:else}
<div class="space-y-2">
{#each related_events as ev}
<a href="/events/{ev.event_id_random}" class="card p-3 variant-soft flex flex-col gap-1 hover:variant-soft-primary transition-all">
<a href="/events/{ev.event_id}" class="card p-3 variant-soft flex flex-col gap-1 hover:variant-soft-primary transition-all">
<span class="font-bold text-sm">{ev.name}</span>
<span class="text-[10px] opacity-60">{new Date(ev.start_datetime).toLocaleDateString()}</span>
</a>
@@ -354,7 +354,7 @@
{:else}
<div class="space-y-2">
{#each related_posts as post}
<a href="/idaa/bb/{post.post_id_random}" class="card p-3 variant-soft flex flex-col gap-1 hover:variant-soft-primary transition-all">
<a href="/idaa/bb/{post.post_id}" class="card p-3 variant-soft flex flex-col gap-1 hover:variant-soft-primary transition-all">
<span class="font-bold text-sm">{post.title}</span>
<div class="flex justify-between items-center text-[10px] opacity-60">
<span>{new Date(post.created_on).toLocaleDateString()}</span>