Files
OSIT-AE-App-Svelte/documentation/old/OLD_README_guidelines_v2.md

174 lines
4.7 KiB
Markdown

# AE Svelte and SvelteKit Technical Standards
## Official Modules
### Core
- Accounts - Minimal
- Files
- People - Minimal
- Sites - Minimal
- Users - Minimal
### Extended
Archives - Minimal, Events - Badges, Events - Presentation Management, Posts - Minimal, Journals
### Custom
IDAA - Archives, IDAA - BB, IDAA - Recovery Meetings
---
## localStorage:
- api
- app - global
- core - core modules
- [module] - extended modules
- [custom] - custom modules
---
## Indexed DB
- ae_core_db
- [module]
- [custom] - custom modules: none currently
---
## Data Sorting
- group > priority > sort > updated/created on
- type > start date/time > code or name
---
## Objects
### Function - Obj Prop Update
- obj_type
- obj_id
- obj_prop
- obj_value
### Core
### Extended
### Custom
---
## Object Properties or Fields
### Core
Expected standard field names: id, id_random, [obj-type]\_id_random, code, name, enable, hide, priority, sort, group, notes, created_on, updated_on
Special use field names: for_type, for_id, archive_on, passcode, external_id
### Configs and Fields with JSON
- cfg_json
- data_json
- linked_li_json
### Special Generated Fields
tmp_sort_1, tmp_sort_2,
### Future standard fields!!!
obj_id?: null|string;
obj_ext_uid?: null|string; // Probably not needed for journals
obj_ext_id?: null|string; // Probably not needed for journals
obj_import_id?: null|string; // Probably not needed for journals
obj_code?: null|string;
obj_account_id?: null|string;
obj_passcode?: null|string;
obj_type?: null|string; // Should always be 'journal' in this case
obj_type_ver_id?: null|string; // The ID from the table for the object type
obj_name?: null|string;
obj_summary?: null|string; // LLM (AI) generated summary...???
obj_outline?: null|string; // LLM (AI) generated outline...???
obj_description?: null|string; // Probably not needed for journals
obj_enable?: null|boolean;
obj_enable_on?: null|Date;
obj_archive_on?: null|Date;
obj_hide?: null|boolean;
obj_priority?: null|number;
obj_sort?: null|number;
obj_group?: null|string;
obj_cfg_json?: null|string;
obj_notes?: null|string;
obj_created_on?: Date;
obj_updated_on?: null|Date;
## Dixie IDB liveQuery with Select Objects (slct) and Lists of Objects (slct_x_li)
Use this method below to create a read/write snapshot of the current liveQuery results. This allows you to use it as part of a form and binding values. It might make since to call this something like "lqw**x_obj" and "lqw**x_obj_li". lqw = liveQuery writable
lq**xyz_obj - Use for general read only
lqw**xyz_obj - Use for forms and binding values. What happens if the actual LQ obj is updated after the bind?
$slct or $lqw ?
Sort of related.... more permission/security though: Create a new table that will be attached to every v\_ view in the DB. This new table would be a field permission list. It could work similar to the data_store table and related view. This seems like a good idea????? 2025-08-11
```ts
let lq__post_obj = $derived(
liveQuery(async () => {
if (log_lvl) {
console.log(`lq__post_obj: post_id = ${$idaa_slct?.post_id}`);
}
let results = await db_posts.post.get($idaa_slct.post_id ?? ''); // null or undefined does not reset things like '' does
// Check if results are different than the current $idaa_slct.post_obj
if ($idaa_slct.post_obj && results) {
if (JSON.stringify($idaa_slct.post_obj) !== JSON.stringify(results)) {
$idaa_slct.post_obj = { ...results };
if (log_lvl) {
console.log(`$idaa_slct.post_obj = `, $idaa_slct.post_obj);
}
} else {
if (log_lvl) {
console.log(`Post object has not changed for post_id: ${$idaa_slct.post_id}`);
}
}
}
return results;
})
);
let lq__post_comment_obj_li = $derived(
liveQuery(async () => {
let results = await db_posts.comment
.where('post_id')
.equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does
.reverse()
.sortBy('updated_on');
// .sortBy('title');
if (
$idaa_slct.post_comment_obj_li &&
JSON.stringify($idaa_slct.post_comment_obj_li) !== JSON.stringify(results)
) {
$idaa_slct.post_comment_obj_li = [...results];
if (log_lvl) {
console.log(`$idaa_slct.post_comment_obj_li = `, $idaa_slct.post_comment_obj_li);
}
} else {
if (log_lvl) {
console.log(
`Post comment object list has not changed for post_id: ${$idaa_slct.post_id}`
);
}
}
return results;
})
);
```