chore: remove feed cache

This commit is contained in:
2023-02-21 12:03:14 +00:00
parent 3f406ec19e
commit a49121c05a
3 changed files with 5 additions and 73 deletions

View File

@ -1,10 +1,9 @@
import Dexie, { Table } from "dexie";
import { TaggedRawEvent, u256 } from "@snort/nostr";
import { u256 } from "@snort/nostr";
import { MetadataCache } from "State/Users";
import { hexToBech32 } from "Util";
export const NAME = "snortDB";
export const VERSION = 3;
export const VERSION = 4;
export interface SubCache {
id: string;
@ -15,27 +14,14 @@ export interface SubCache {
const STORES = {
users: "++pubkey, name, display_name, picture, nip05, npub",
events: "++id, pubkey, created_at",
feeds: "++id",
};
export class SnortDB extends Dexie {
users!: Table<MetadataCache>;
events!: Table<TaggedRawEvent>;
feeds!: Table<SubCache>;
constructor() {
super(NAME);
this.version(VERSION)
.stores(STORES)
.upgrade(async tx => {
await tx
.table("users")
.toCollection()
.modify(user => {
user.npub = hexToBech32("npub", user.pubkey);
});
});
this.version(VERSION).stores(STORES);
}
}