Working on posts with linked content (hosted files).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_posts } from "$lib/db_posts";
|
||||
import { db_posts } from "$lib/ae_posts/db_posts";
|
||||
|
||||
import { load_ae_obj_li__post_comment } from "$lib/ae_posts/ae_posts__post_comment";
|
||||
|
||||
@@ -652,18 +652,22 @@ export function db_save_ae_obj_li__post(
|
||||
topic: obj.topic,
|
||||
topic_name: obj.topic_name,
|
||||
|
||||
title: obj.title,
|
||||
name: obj.title,
|
||||
title: obj.title, // Switching to name instead of title
|
||||
// summary: obj.summary,
|
||||
content: obj.content,
|
||||
|
||||
anonymous: obj.anonymous,
|
||||
full_name: obj.full_name,
|
||||
email: obj.email,
|
||||
notify: obj.notify,
|
||||
|
||||
enable_comments: obj.enable_comments,
|
||||
|
||||
archive: obj.archive,
|
||||
archive_on: obj.archive_on,
|
||||
|
||||
linked_li_json: obj.linked_li_json,
|
||||
cfg_json: obj.cfg_json,
|
||||
|
||||
enable: obj.enable,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_posts } from "$lib/db_posts";
|
||||
import { db_posts } from "$lib/ae_posts/db_posts";
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
@@ -328,15 +328,17 @@ export function db_save_ae_obj_li__post_comment(
|
||||
|
||||
external_person_id: obj.external_person_id,
|
||||
|
||||
// name: obj.name,
|
||||
name: obj.name,
|
||||
title: obj.title, // Switching to name instead of title
|
||||
// summary: obj.summary,
|
||||
title: obj.title,
|
||||
content: obj.content,
|
||||
|
||||
anonymous: obj.anonymous,
|
||||
full_name: obj.full_name,
|
||||
email: obj.email,
|
||||
notify: obj.notify,
|
||||
|
||||
linked_li_json: obj.linked_li_json,
|
||||
cfg_json: obj.cfg_json,
|
||||
|
||||
enable: obj.enable,
|
||||
|
||||
124
src/lib/ae_posts/db_posts.ts
Normal file
124
src/lib/ae_posts/db_posts.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
import Dexie, { type Table } from 'dexie';
|
||||
|
||||
import type { key_val } from '../ae_stores';
|
||||
|
||||
// li = list
|
||||
// kv = key value list
|
||||
|
||||
// Updated 2024-11-13
|
||||
export interface Post {
|
||||
id: string;
|
||||
// id_random: string;
|
||||
post_id: string;
|
||||
// post_id_random: string;
|
||||
|
||||
account_id: string;
|
||||
// account_id_random: string;
|
||||
|
||||
person_id?: null|string;
|
||||
external_person_id?: null|string; // For IDAA this is the Novi UUID
|
||||
user_id?: null|string;
|
||||
|
||||
topic_id?: string;
|
||||
topic?: string; // or topic_name?
|
||||
topic_name?: string;
|
||||
|
||||
name: null|string;
|
||||
title: null|string;
|
||||
// summary?: null|string;
|
||||
content?: null|string;
|
||||
|
||||
anonymous?: null|boolean;
|
||||
full_name?: null|string;
|
||||
email?: null|string;
|
||||
notify?: null|boolean;
|
||||
|
||||
enable_comments?: null|boolean;
|
||||
|
||||
archive?: null|boolean;
|
||||
archive_on?: Date;
|
||||
|
||||
linked_li_json?: null|string;
|
||||
cfg_json?: null|key_val;
|
||||
|
||||
enable: null|boolean;
|
||||
hide?: null|boolean;
|
||||
priority?: null|boolean
|
||||
sort?: null|number;
|
||||
group?: null|string;
|
||||
notes?: null|string;
|
||||
created_on: Date;
|
||||
updated_on?: null|Date;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
post_comment_count?: number;
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-11-13
|
||||
export interface Post_Comment {
|
||||
id: string;
|
||||
// id_random: string;
|
||||
post_comment_id: string;
|
||||
// post_comment_id_random: string;
|
||||
|
||||
post_id: string;
|
||||
// post_id_random: string;
|
||||
|
||||
external_person_id?: null|string; // For IDAA this is the Novi UUID
|
||||
|
||||
name: null|string;
|
||||
title: null|string;
|
||||
// summary?: null|string;
|
||||
content?: null|string;
|
||||
|
||||
anonymous?: null|boolean;
|
||||
full_name?: null|string;
|
||||
email?: null|string;
|
||||
notify?: null|boolean;
|
||||
|
||||
linked_li_json?: null|string;
|
||||
cfg_json?: null|key_val;
|
||||
|
||||
enable: null|boolean;
|
||||
hide?: null|boolean;
|
||||
priority?: null|boolean
|
||||
sort?: null|number;
|
||||
group?: null|string;
|
||||
notes?: null|string;
|
||||
created_on: Date;
|
||||
updated_on?: null|Date;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-25
|
||||
export class MySubClassedDexie extends Dexie {
|
||||
// We just tell the typing system this is the case
|
||||
post!: Table<Post>;
|
||||
comment!: Table<Post_Comment>;
|
||||
|
||||
constructor() {
|
||||
super('ae_posts_db');
|
||||
this.version(1).stores({
|
||||
post: `
|
||||
id, post_id,
|
||||
account_id,
|
||||
topic_id, topic,
|
||||
title,
|
||||
full_name, email,
|
||||
archive, archive_on,
|
||||
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on], [created_on+updated_on]`,
|
||||
|
||||
comment: `
|
||||
id, post_comment_id,
|
||||
post_id,
|
||||
title,
|
||||
full_name, email,
|
||||
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on]`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const db_posts = new MySubClassedDexie();
|
||||
Reference in New Issue
Block a user