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:
@@ -174,7 +174,7 @@ export async function load_ae_obj_li__post({
|
||||
ae_promises.load__post_obj_li[i].post_comment_li = await load_ae_obj_li__post_comment({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'post',
|
||||
for_obj_id: post_obj.post_id_random,
|
||||
for_obj_id: post_obj.post_id,
|
||||
enabled,
|
||||
hidden,
|
||||
limit,
|
||||
@@ -213,7 +213,7 @@ export async function create_ae_obj__post({
|
||||
api_cfg,
|
||||
obj_type: 'post',
|
||||
fields: {
|
||||
account_id_random: account_id,
|
||||
account_id: account_id,
|
||||
...data_kv
|
||||
},
|
||||
params,
|
||||
@@ -358,7 +358,7 @@ export async function qry__post({
|
||||
const search_query: any = { and: [] };
|
||||
|
||||
if (account_id) {
|
||||
search_query.and.push({ field: 'account_id_random', op: 'eq', value: account_id });
|
||||
search_query.and.push({ field: 'account_id', op: 'eq', value: account_id });
|
||||
}
|
||||
|
||||
if (qry_str) {
|
||||
@@ -431,7 +431,7 @@ export async function qry__post({
|
||||
ae_promises.load__post_obj_li[i].post_comment_li = await load_ae_obj_li__post_comment({
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'post',
|
||||
for_obj_id: post_obj.post_id_random,
|
||||
for_obj_id: post_obj.post_id,
|
||||
enabled,
|
||||
hidden,
|
||||
limit,
|
||||
@@ -547,7 +547,7 @@ export async function process_ae_obj__post_props({
|
||||
if (!obj.account_id) obj.account_id = account_id;
|
||||
if (!obj.account_id_random) obj.account_id_random = account_id;
|
||||
}
|
||||
obj.name = obj.title;
|
||||
obj.name = obj.title;
|
||||
const sort_val = (obj.sort ?? 0).toString().padStart(3, '0');
|
||||
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
|
||||
sort_val
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const editable_fields__post_comment = [
|
||||
'post_id',
|
||||
'post_id_random',
|
||||
// 'post_id_random',
|
||||
'name',
|
||||
'title',
|
||||
'content',
|
||||
|
||||
@@ -14,12 +14,9 @@ import type { key_val } from '$lib/stores/ae_stores';
|
||||
*/
|
||||
export interface Post {
|
||||
id: string;
|
||||
// id_random: string;
|
||||
post_id: string;
|
||||
// post_id_random: string;
|
||||
|
||||
account_id: string;
|
||||
// account_id_random: string;
|
||||
|
||||
person_id?: null | string;
|
||||
external_person_id?: null | string; // For IDAA this is the Novi UUID
|
||||
@@ -78,12 +75,9 @@ export interface Post {
|
||||
*/
|
||||
export interface Post_Comment {
|
||||
id: string;
|
||||
// id_random: string;
|
||||
post_comment_id: string;
|
||||
// post_comment_id_random: string;
|
||||
|
||||
post_id: string;
|
||||
// post_id_random: string;
|
||||
|
||||
external_person_id?: null | string; // For IDAA this is the Novi UUID
|
||||
|
||||
@@ -114,6 +108,7 @@ export interface Post_Comment {
|
||||
tmp_sort_2?: null | string;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
account_id: string;
|
||||
}
|
||||
|
||||
// Updated 2026-02-05
|
||||
|
||||
Reference in New Issue
Block a user