Now with the ability to clone template entries

This commit is contained in:
Scott Idem
2025-04-02 12:56:08 -04:00
parent 0e72d27dbd
commit b4f2be0f13
9 changed files with 184 additions and 189 deletions

View File

@@ -14,12 +14,24 @@ export async function load_ae_obj_id__journal(
api_cfg,
journal_id,
inc_entry_li = false,
enabled = 'enabled',
hidden = 'not_hidden',
limit = 99,
offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
params = {},
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
journal_id: string,
inc_entry_li?: boolean,
enabled?: string, // all, disabled, enabled
hidden?: string, // all, hidden, not_hidden
limit?: number,
offset?: number,
order_by_li?: key_val, // Order by fields for the journal entries
params?: key_val,
try_cache?: boolean,
log_lvl?: number
}
@@ -28,8 +40,6 @@ export async function load_ae_obj_id__journal(
console.log(`*** load_ae_obj_id__journal() *** journal_id=${journal_id}`);
}
let params = {};
ae_promises.load__journal_obj = await api.get_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'journal',
@@ -72,7 +82,12 @@ export async function load_ae_obj_id__journal(
api_cfg: api_cfg,
for_obj_type: 'journal',
for_obj_id: journal_id,
params: {qry__enabled: 'all', qry__limit: 99},
enabled: enabled, // all, disabled, enabled
hidden: hidden, // all, hidden, not_hidden
limit: limit, // Limit for the entries
offset: offset,
order_by_li: order_by_li,
params: params,
try_cache: try_cache,
log_lvl: log_lvl
})
@@ -180,6 +195,11 @@ export async function load_ae_obj_li__journal(
api_cfg: api_cfg,
for_obj_type: 'journal',
for_obj_id: journal_id,
enabled: enabled,
hidden: hidden,
limit: limit,
offset: offset,
order_by_li: order_by_li,
params: params,
try_cache: try_cache,
log_lvl: log_lvl
@@ -532,6 +552,7 @@ export function db_save_ae_obj_li__journal(
person_id: obj.person_id_random,
name: obj.name,
short_name: obj.short_name,
summary: obj.summary,
outline: obj.outline,
@@ -549,9 +570,9 @@ export function db_save_ae_obj_li__journal(
sort_by: obj.sort_by,
sort_by_desc: obj.sort_by_desc,
cfg_json: obj.cfg_json,
cfg_json: obj.cfg_json ?? {},
data_json: obj.data_json,
data_json: obj.data_json ?? {},
// ux_mode: obj.ux_mode,

View File

@@ -357,6 +357,8 @@ export async function db_save_ae_obj_li__journal_entry(
person_id: obj.person_id_random,
template: obj.template ?? null, // Allow for a template to be used, otherwise null
activity_code: obj.activity_code,
category_code: obj.category_code,
type_code: obj.type_code,
@@ -369,6 +371,7 @@ export async function db_save_ae_obj_li__journal_entry(
professional: obj.professional,
name: obj.name,
short_name: obj.short_name ?? null,
summary: obj.summary,
outline: obj.outline,
// description: obj.description,
@@ -403,8 +406,8 @@ export async function db_save_ae_obj_li__journal_entry(
alert: obj.alert,
alert_msg: obj.alert_msg,
// cfg_json: obj.cfg_json,
data_json: obj.data_json,
// cfg_json: obj.cfg_json ?? {},
data_json: obj.data_json ?? {},
// This only allows for basic access to the data.
// passcode_read: obj.passcode_read, // For LLM (AI) generated summary...???

View File

@@ -26,6 +26,8 @@ export interface Journal {
for_type?: null|string;
for_id?: null|string;
// template?: null|boolean; // Is this a template journal? If true, it can be used to create new journals.
type_code?: null|string;
account_id?: null|string; // Owner account of the journal
@@ -34,6 +36,7 @@ export interface Journal {
// location_id?: null|string; // Assign to a location???
name: string; // or the title
short_name?: null|string; // Short name for the journal, if any. Used for display purposes.
summary?: null|string; // LLM (AI) generated summary...???
outline?: null|string; // LLM (AI) generated outline...???
@@ -136,7 +139,7 @@ export interface Journal_Entry {
id: string; // actually "id_random"
journal_entry_id: string;
journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries.
// journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries.
// Essentially this is a change log of journal entries
snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journal entries.
@@ -150,6 +153,8 @@ export interface Journal_Entry {
for_type?: null|string;
for_id?: null|string;
template?: null|boolean; // Is this a template journal entry? If true, it can be used to create new journal entries.
activity_code?: null|string;
category_code?: null|string;
topic_code?: null|string;
@@ -169,6 +174,7 @@ export interface Journal_Entry {
professional?: null|boolean;
name: string; // or the title
short_name?: null|string; // Short name for the journal entry, if any. Used for display purposes. Most likely for the templates list.
summary?: null|string; // LLM (AI) generated summary...???
outline?: null|string; // LLM (AI) generated outline...???
// description?: null|string; // This is the description of the journal entry
@@ -294,6 +300,7 @@ export class MySubClassedDexie extends Dexie {
journal_id,
code,
account_id,
template,
name,
start_datetime, end_datetime,
timezone,