Work on the new Journals. Just saving things while they are working well.

This commit is contained in:
Scott Idem
2025-03-21 11:03:38 -04:00
parent 596986afb7
commit 35354a9d0f
10 changed files with 630 additions and 118 deletions

View File

@@ -165,6 +165,11 @@ export async function create_ae_obj__journal_entry(
console.log(`*** create_ae_obj__journal_entry() *** journal_id=${journal_id}`);
}
if (!journal_id) {
console.log(`ERROR: Journals - Entry - journal_id required to create`);
return false;
}
ae_promises.create__journal_entry = await api.create_ae_obj_crud({
api_cfg: api_cfg,
obj_type: 'journal_entry',
@@ -348,9 +353,10 @@ export async function db_save_ae_obj_li__journal_entry(
person_id: obj.person_id_random,
activity: obj.activity,
category: obj.category,
topic: obj.topic,
activity_code: obj.activity_code,
category_code: obj.category_code,
type_code: obj.type_code,
topic_code: obj.topic_code,
public: obj.public,
private: obj.private,

View File

@@ -7,7 +7,7 @@ import type { key_val } from '$lib/ae_stores';
/* *** BEGIN *** Initialize journals_local_data_struct */
// This is for longer term or sticky app data. This should be stored to *local* storage.
// Updated 2024-08-20
// Updated 2025-03-20
let journals_local_data_struct: key_val = {
ver: '2024-08-20_19',
// Shared
@@ -27,6 +27,15 @@ let journals_local_data_struct: key_val = {
qry__offset: 0,
qry__journal_id: null,
journal: {
edit: false,
edit_kv: {},
},
entry: {
edit: false,
edit_kv: {},
},
};
// console.log(`AE Stores - App Journals Local Storage Data:`, journals_local_data_struct);
@@ -35,10 +44,9 @@ export let journals_loc: Writable<key_val> = localStorageStore('ae_journals_loc'
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
/* *** BEGIN *** Initialize journals_session_data_struct */
// Temporary app data. This is lost if the page is refreshed or using different tabs/windows. This should be stored to *session* storage.
// Updated 2024-08-20
// Updated 2025-03-20
let journals_session_data_struct: key_val = {
ver: '2024-08-20_19',
log_lvl: 1,
@@ -53,6 +61,15 @@ let journals_session_data_struct: key_val = {
show_list__journal_entry_li_group: true,
show__modal_view__journal_entry_id: null,
show__modal_edit__journal_entry_id: null,
journal: {
edit: false,
edit_kv: {},
},
entry: {
edit: false,
edit_kv: {},
},
};
// console.log(`AE Stores - App Journals Session Storage Data:`, journals_session_data_struct);
export let journals_sess = writable(journals_session_data_struct);

View File

@@ -147,7 +147,11 @@ export interface Journal_Entry {
for_type?: null|string;
for_id?: null|string;
activity_code?: null|string;
category_code?: null|string;
topic_code?: null|string;
type_code?: null|string;
journal_entry_type?: null|string; // This is the type of journal entry
account_id?: null|string; // Owner account of the journal
@@ -155,10 +159,6 @@ export interface Journal_Entry {
// event_id?: null|string; // Assign to an event???
// location_id?: null|string; // Assign to a location???
activity?: null|string;
category?: null|string;
topic?: null|string;
public?: null|boolean;
private?: null|boolean;
personal?: null|boolean;
@@ -176,10 +176,23 @@ export interface Journal_Entry {
start_datetime?: null|Date;
end_datetime?: null|Date;
timezone?: null|string;
seconds?: null|number; // Duration in seconds
location?: null|string; // Location of the journal entry
latitude?: null|number; // Latitude of the journal entry
longitude?: null|number; // Longitude of the journal entry
billable?: null|boolean; // Is this billable?
bill_to?: null|string; // Who to bill for this journal entry
bill_rate?: null|number; // Rate to bill for this journal entry
billable_minutes?: null|number; // Billable minutes for this journal entry
alert?: null|boolean; // LLM (AI) generated summary...???
alert_msg?: null|string; // LLM (AI) generated summary...???
parent_id?: null|string; // This is the parent journal entry ID. If deleted, then delete all children journal entries.
related_entry_id_li?: null|key_val; // List of related journal entry IDs
// cfg_json?: null|key_val; // This is the configuration JSON for the journal entry
data_json?: null|string; // We always need to store something extra...