Files
OSIT-AE-App-Svelte/src/lib/ae_posts/db_posts.ts
Scott Idem 7e1eaba3bc feat: Migrate ESLint to flat config and resolve initial linting errors
Migrated the ESLint configuration to the new flat config format ()
and addressed several initial linting errors.

Key changes include:
- Updated ESLint configuration to treat  as warnings instead of errors.
- Fixed  errors in  by declaring  and .
- Corrected  error in  by using  instead of an out-of-scope .
- Resolved  error in  by replacing the undefined  directive with the  component.
- Addressed  errors in  by replacing  with  and  with .
- Fixed  errors in  by importing necessary modules (, , ) and adding missing props (, , , , ).
2025-11-17 18:46:54 -05:00

140 lines
3.2 KiB
TypeScript

import Dexie, { type Table } from 'dexie';
import type { key_val } from '$lib/stores/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?: null | 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;
// Generated fields for sorting locally only
tmp_sort_1?: null | string;
tmp_sort_2?: null | string;
// Additional fields for convenience (database views)
post_comment_count?: number;
// Placeholder for generated temp data
hosted_file_id_li?: null | Array<string>;
hosted_file_obj_li?: null | Array<any>;
upload_complete?: boolean;
}
// 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;
// Generated fields for sorting locally only
tmp_sort_1?: null | string;
tmp_sort_2?: null | string;
// 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,
name,
title,
full_name, email,
archive, archive_on,
tmp_sort_1, tmp_sort_2,
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,
name,
title,
full_name, email,
tmp_sort_1, tmp_sort_2,
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on]`
});
}
}
export const db_posts = new MySubClassedDexie();