chore: remove feed cache
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user