chore(cleanup): add journal AI shortcut and align posts tmp_sort

This commit is contained in:
Scott Idem
2026-06-02 14:43:16 -04:00
parent 84a9d0fffc
commit 1de87b6c5f
6 changed files with 64 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api';
import { build_tmp_sort } from '$lib/ae_core/core__idb_sort';
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_posts } from '$lib/ae_posts/db_posts';
@@ -570,15 +571,16 @@ export async function process_ae_obj__post_props({
if (!obj.account_id_random) obj.account_id_random = account_id;
}
obj.name = obj.title;
const sort_val = (obj.sort ?? 0).toString().padStart(3, '0');
const updated =
obj.updated_on ?? obj.created_on ?? new Date(0).toISOString();
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${updated}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on ?? ''}_${obj.created_on ?? ''}`;
const { tmp_sort_1, tmp_sort_2 } = build_tmp_sort({
prefix: [obj.group ?? ''],
priority: obj.priority,
sort: obj.sort,
fields_1: [obj.updated_on ?? obj.created_on ?? ''],
fields_2: [obj.updated_on ?? '', obj.created_on ?? ''],
pad_width: 8
});
obj.tmp_sort_1 = tmp_sort_1;
obj.tmp_sort_2 = tmp_sort_2;
return obj;
}

View File

@@ -1,5 +1,6 @@
import type { key_val } from '$lib/stores/ae_stores';
import { api } from '$lib/api/api';
import { build_tmp_sort } from '$lib/ae_core/core__idb_sort';
import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie';
import { db_posts } from '$lib/ae_posts/db_posts';
@@ -383,15 +384,16 @@ export async function process_ae_obj__post_comment_props({
obj_type: 'post_comment',
log_lvl,
specific_processor: (obj) => {
const sort_val = (obj.sort ?? 0).toString().padStart(3, '0');
const updated =
obj.updated_on ?? obj.created_on ?? new Date(0).toISOString();
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${updated}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on ?? ''}_${obj.created_on ?? ''}`;
const { tmp_sort_1, tmp_sort_2 } = build_tmp_sort({
prefix: [obj.group ?? ''],
priority: obj.priority,
sort: obj.sort,
fields_1: [obj.updated_on ?? obj.created_on ?? ''],
fields_2: [obj.updated_on ?? '', obj.created_on ?? ''],
pad_width: 8
});
obj.tmp_sort_1 = tmp_sort_1;
obj.tmp_sort_2 = tmp_sort_2;
return obj;
}