Work on Dexie liveQuery for Journals
This commit is contained in:
2
package-lock.json
generated
2
package-lock.json
generated
@@ -17,7 +17,7 @@
|
|||||||
"@tiptap/extension-paragraph": "^2.10.2",
|
"@tiptap/extension-paragraph": "^2.10.2",
|
||||||
"axios": "^1.7.0",
|
"axios": "^1.7.0",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"dexie": "^4.0.1-beta.14",
|
"dexie": "^4.0.11",
|
||||||
"flowbite-svelte": "^0.48.00",
|
"flowbite-svelte": "^0.48.00",
|
||||||
"html5-qrcode": "^2.3.8",
|
"html5-qrcode": "^2.3.8",
|
||||||
"lucide-svelte": "^0.483.0",
|
"lucide-svelte": "^0.483.0",
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
"@tiptap/extension-paragraph": "^2.10.2",
|
"@tiptap/extension-paragraph": "^2.10.2",
|
||||||
"axios": "^1.7.0",
|
"axios": "^1.7.0",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"dexie": "^4.0.1-beta.14",
|
"dexie": "^4.0.11",
|
||||||
"flowbite-svelte": "^0.48.00",
|
"flowbite-svelte": "^0.48.00",
|
||||||
"html5-qrcode": "^2.3.8",
|
"html5-qrcode": "^2.3.8",
|
||||||
"lucide-svelte": "^0.483.0",
|
"lucide-svelte": "^0.483.0",
|
||||||
|
|||||||
@@ -543,8 +543,7 @@ export function db_save_ae_obj_li__journal(
|
|||||||
let description_md_html: null|string = await marked.parse(description_cleaned ?? '') ?? null;
|
let description_md_html: null|string = await marked.parse(description_cleaned ?? '') ?? null;
|
||||||
// let description_md_html_alt: null|string = await marked.parse(description_cleaned ?? '', { gfm: false }) ?? null;
|
// let description_md_html_alt: null|string = await marked.parse(description_cleaned ?? '', { gfm: false }) ?? null;
|
||||||
|
|
||||||
try {
|
let obj_record = {
|
||||||
const id_random = await db_journals.journal.put({
|
|
||||||
id: obj.journal_id_random,
|
id: obj.journal_id_random,
|
||||||
journal_id: obj.journal_id_random,
|
journal_id: obj.journal_id_random,
|
||||||
|
|
||||||
@@ -614,15 +613,36 @@ export function db_save_ae_obj_li__journal(
|
|||||||
// A key value list of the others
|
// A key value list of the others
|
||||||
// journal_other_kv: obj.journal_other_kv,
|
// journal_other_kv: obj.journal_other_kv,
|
||||||
// journal_other_li: obj.journal_other_li,
|
// journal_other_li: obj.journal_other_li,
|
||||||
});
|
};
|
||||||
// console.log(`Put obj with ID: ${obj.journal_id_random} or ${id_random}`);
|
|
||||||
} catch (error) {
|
|
||||||
let status = `Failed to put ${obj.journal_id_random}: ${error}`;
|
|
||||||
console.log(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// const id_random = await db_journals.journal.put(obj);
|
let id_random = null;
|
||||||
// console.log(`Put obj with ID: ${obj.journal_id_random}`);
|
|
||||||
|
try {
|
||||||
|
id_random = await db_journals.journal.update(obj_record.id, obj_record);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error: Failed to update ${obj_record.id}: ${error}`);
|
||||||
|
}
|
||||||
|
if (!id_random) {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
id_random = await db_journals.journal.put(obj_record);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error: Failed to put ${obj.journal_id_random}: ${error}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Updated record with ID: ${obj_record.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!id_random) {
|
||||||
|
console.log(`Failed to save record with ID: ${obj_record.id}`);
|
||||||
|
} else {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Saved record with ID: ${obj_record.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -344,8 +344,7 @@ export async function db_save_ae_obj_li__journal_entry(
|
|||||||
let content_md_html: null|string = await marked.parse(content_cleaned ?? '') ?? null;
|
let content_md_html: null|string = await marked.parse(content_cleaned ?? '') ?? null;
|
||||||
// let content_md_html_alt: null|string = await marked.parse(content_cleaned ?? '', { gfm: false }) ?? null;
|
// let content_md_html_alt: null|string = await marked.parse(content_cleaned ?? '', { gfm: false }) ?? null;
|
||||||
|
|
||||||
try {
|
let obj_record = {
|
||||||
const id_random = await db_journals.journal_entry.put({
|
|
||||||
id: obj.journal_entry_id_random,
|
id: obj.journal_entry_id_random,
|
||||||
journal_entry_id: obj.journal_entry_id_random,
|
journal_entry_id: obj.journal_entry_id_random,
|
||||||
|
|
||||||
@@ -445,15 +444,36 @@ export async function db_save_ae_obj_li__journal_entry(
|
|||||||
// A key value list of the others
|
// A key value list of the others
|
||||||
// journal_other_kv: obj.journal_other_kv,
|
// journal_other_kv: obj.journal_other_kv,
|
||||||
// journal_other_li: obj.journal_other_li,
|
// journal_other_li: obj.journal_other_li,
|
||||||
});
|
};
|
||||||
// console.log(`Put obj with ID: ${obj.journal_entry_id_random} or ${id_random}`);
|
|
||||||
} catch (error) {
|
|
||||||
let status = `Failed to put ${obj.journal_entry_id_random}: ${error}`;
|
|
||||||
console.log(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
// const id_random = await db_journals.journal_entry.put(obj);
|
let id_random = null;
|
||||||
// console.log(`Put obj with ID: ${obj.journal_entry_id_random}`);
|
|
||||||
|
try {
|
||||||
|
id_random = await db_journals.journal_entry.update(obj_record.id, obj_record);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error: Failed to update ${obj_record.id}: ${error}`);
|
||||||
|
}
|
||||||
|
if (!id_random) {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Failed to update record with ID: ${obj_record.id}. Trying put...`);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
id_random = await db_journals.journal_entry.put(obj_record);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`Error: Failed to put ${obj.journal_entry_id_random}: ${error}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Updated record with ID: ${obj_record.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!id_random) {
|
||||||
|
console.log(`Failed to save record with ID: ${obj_record.id}`);
|
||||||
|
} else {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Saved record with ID: ${obj_record.id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user