style(journals): apply expanded 80-width formatting and snake_case
- Batch formatted all Journals module files using Prettier with printWidth: 80. - Refactored preventDefault to prevent_default across all Svelte components. - Standardized line breaks for imports and long attribute lists for better readability. - Ensured consistent snake_case naming for internal identifiers.
This commit is contained in:
@@ -22,7 +22,9 @@ export async function load_ae_obj_id__journal_entry({
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_JournalEntry | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`);
|
||||
console.log(
|
||||
`*** load_ae_obj_id__journal_entry() *** journal_entry_id=${journal_entry_id}`
|
||||
);
|
||||
}
|
||||
|
||||
ae_promises.load__journal_entry_obj = await api
|
||||
@@ -36,10 +38,11 @@ export async function load_ae_obj_id__journal_entry({
|
||||
if (journal_entry_obj_get_result) {
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
const processed_obj_li = await process_ae_obj__journal_entry_props({
|
||||
obj_li: [journal_entry_obj_get_result],
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
const processed_obj_li =
|
||||
await process_ae_obj__journal_entry_props({
|
||||
obj_li: [journal_entry_obj_get_result],
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
@@ -138,11 +141,15 @@ export async function load_ae_obj_li__journal_entry({
|
||||
if (journal_entry_obj_li_get_result) {
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
const processed_obj_li = await process_ae_obj__journal_entry_props({
|
||||
obj_li: journal_entry_obj_li_get_result,
|
||||
journal_id: for_obj_type === 'journal' ? for_obj_id : undefined,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
const processed_obj_li =
|
||||
await process_ae_obj__journal_entry_props({
|
||||
obj_li: journal_entry_obj_li_get_result,
|
||||
journal_id:
|
||||
for_obj_type === 'journal'
|
||||
? for_obj_id
|
||||
: undefined,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
@@ -197,7 +204,9 @@ export async function create_ae_obj__journal_entry({
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_JournalEntry | null> {
|
||||
if (log_lvl) {
|
||||
console.log(`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`);
|
||||
console.log(
|
||||
`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`
|
||||
);
|
||||
}
|
||||
|
||||
if (!journal_id) {
|
||||
@@ -219,11 +228,12 @@ export async function create_ae_obj__journal_entry({
|
||||
if (journal_entry_obj_create_result) {
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
const processed_obj_li = await process_ae_obj__journal_entry_props({
|
||||
obj_li: [journal_entry_obj_create_result],
|
||||
journal_id,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
const processed_obj_li =
|
||||
await process_ae_obj__journal_entry_props({
|
||||
obj_li: [journal_entry_obj_create_result],
|
||||
journal_id,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
@@ -342,36 +352,64 @@ export async function qry__journal_entry({
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** qry__journal_entry() *** journal_id=${journal_id} person_id=${person_id}`);
|
||||
console.log(
|
||||
`*** qry__journal_entry() *** journal_id=${journal_id} person_id=${person_id}`
|
||||
);
|
||||
}
|
||||
|
||||
const search_query: any = { and: [] };
|
||||
|
||||
if (qry_str) {
|
||||
// Using 'like' with wildcards to ensure compatibility
|
||||
search_query.and.push({ field: 'default_qry_str', op: 'like', value: `%${qry_str.trim()}%` });
|
||||
params['lk_qry'] = { 'default_qry_str': qry_str.trim() };
|
||||
search_query.and.push({
|
||||
field: 'default_qry_str',
|
||||
op: 'like',
|
||||
value: `%${qry_str.trim()}%`
|
||||
});
|
||||
params['lk_qry'] = { default_qry_str: qry_str.trim() };
|
||||
}
|
||||
|
||||
if (qry_category_code) {
|
||||
search_query.and.push({ field: 'category_code', op: 'eq', value: qry_category_code });
|
||||
search_query.and.push({
|
||||
field: 'category_code',
|
||||
op: 'eq',
|
||||
value: qry_category_code
|
||||
});
|
||||
}
|
||||
|
||||
if (qry_created_on) {
|
||||
search_query.and.push({ field: 'created_on', op: 'gt', value: qry_created_on });
|
||||
search_query.and.push({
|
||||
field: 'created_on',
|
||||
op: 'gt',
|
||||
value: qry_created_on
|
||||
});
|
||||
}
|
||||
|
||||
if (qry_priority) {
|
||||
search_query.and.push({ field: 'priority', op: 'eq', value: qry_priority });
|
||||
search_query.and.push({
|
||||
field: 'priority',
|
||||
op: 'eq',
|
||||
value: qry_priority
|
||||
});
|
||||
}
|
||||
|
||||
// Context scoping: Prefer journal_id if provided, otherwise fallback to person_id (global search)
|
||||
if (journal_id) {
|
||||
search_query.and.push({ field: 'journal_id_random', op: 'eq', value: journal_id });
|
||||
search_query.and.push({
|
||||
field: 'journal_id_random',
|
||||
op: 'eq',
|
||||
value: journal_id
|
||||
});
|
||||
} else if (person_id) {
|
||||
search_query.and.push({ field: 'person_id_random', op: 'eq', value: person_id });
|
||||
search_query.and.push({
|
||||
field: 'person_id_random',
|
||||
op: 'eq',
|
||||
value: person_id
|
||||
});
|
||||
} else {
|
||||
console.warn('qry__journal_entry: No journal_id or person_id provided. Search might be too broad.');
|
||||
console.warn(
|
||||
'qry__journal_entry: No journal_id or person_id provided. Search might be too broad.'
|
||||
);
|
||||
}
|
||||
|
||||
// Add enabled/hidden filters
|
||||
@@ -413,11 +451,12 @@ export async function qry__journal_entry({
|
||||
|
||||
if (valid_result_li && valid_result_li.length > 0) {
|
||||
if (try_cache) {
|
||||
const processed_obj_li = await process_ae_obj__journal_entry_props({
|
||||
obj_li: valid_result_li,
|
||||
journal_id,
|
||||
log_lvl
|
||||
});
|
||||
const processed_obj_li =
|
||||
await process_ae_obj__journal_entry_props({
|
||||
obj_li: valid_result_li,
|
||||
journal_id,
|
||||
log_lvl
|
||||
});
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_journals,
|
||||
table_name: 'journal_entry',
|
||||
@@ -907,12 +946,16 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
const updated = processed_obj.updated_on ?? processed_obj.created_on;
|
||||
const name = processed_obj.name ?? '';
|
||||
|
||||
(processed_obj as any).tmp_sort_1 = `${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 = `${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_1 =
|
||||
`${group}_${priority}_${sort}_${updated}`;
|
||||
(processed_obj as any).tmp_sort_2 =
|
||||
`${group}_${priority}_${sort}_${name}_${updated}`;
|
||||
|
||||
// --- Specific Transformations ---
|
||||
if (specific_processor) {
|
||||
processed_obj = await Promise.resolve(specific_processor(processed_obj));
|
||||
processed_obj = await Promise.resolve(
|
||||
specific_processor(processed_obj)
|
||||
);
|
||||
}
|
||||
|
||||
processed_obj_li.push(processed_obj as T);
|
||||
@@ -952,8 +995,12 @@ export async function process_ae_obj__journal_entry_props({
|
||||
content_cleaned = null;
|
||||
content_md_html = null;
|
||||
} else {
|
||||
content_cleaned = content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, '');
|
||||
content_md_html = (await marked.parse(content_cleaned ?? '')) ?? null;
|
||||
content_cleaned = content.replace(
|
||||
/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,
|
||||
''
|
||||
);
|
||||
content_md_html =
|
||||
(await marked.parse(content_cleaned ?? '')) ?? null;
|
||||
}
|
||||
obj.content = content;
|
||||
obj.content_md_html = content_md_html;
|
||||
@@ -968,8 +1015,12 @@ export async function process_ae_obj__journal_entry_props({
|
||||
history_cleaned = null;
|
||||
history_md_html = null;
|
||||
} else {
|
||||
history_cleaned = history.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, '');
|
||||
history_md_html = (await marked.parse(history_cleaned ?? '')) ?? null;
|
||||
history_cleaned = history.replace(
|
||||
/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/,
|
||||
''
|
||||
);
|
||||
history_md_html =
|
||||
(await marked.parse(history_cleaned ?? '')) ?? null;
|
||||
}
|
||||
obj.history = history;
|
||||
obj.history_md_html = history_md_html;
|
||||
|
||||
Reference in New Issue
Block a user