feat: interaction cache

This commit is contained in:
2023-04-25 12:57:09 +01:00
parent ce6a4ce35c
commit 69ec48141b
6 changed files with 115 additions and 59 deletions

View File

@ -3,7 +3,7 @@ import { FullRelaySettings, HexKey, RawEvent, u256 } from "@snort/nostr";
import { MetadataCache } from "Cache";
export const NAME = "snortDB";
export const VERSION = 7;
export const VERSION = 8;
export interface SubCache {
id: string;
@ -24,12 +24,22 @@ export interface UsersRelays {
relays: FullRelaySettings[];
}
export interface EventInteraction {
id: u256;
event: u256;
by: HexKey;
reacted: boolean;
zapped: boolean;
reposted: boolean;
}
const STORES = {
users: "++pubkey, name, display_name, picture, nip05, npub",
relays: "++addr",
userRelays: "++pubkey",
events: "++id, pubkey, created_at",
dms: "++id, pubkey",
eventInteraction: "++id",
};
export class SnortDB extends Dexie {
@ -39,6 +49,7 @@ export class SnortDB extends Dexie {
userRelays!: Table<UsersRelays>;
events!: Table<RawEvent>;
dms!: Table<RawEvent>;
eventInteraction!: Table<EventInteraction>;
constructor() {
super(NAME);