Add an EventStore interface, refactor eventsDB

This commit is contained in:
Alex Gleason
2023-12-29 13:12:16 -06:00
parent 62071173d9
commit e6c8d1dad9
15 changed files with 124 additions and 104 deletions

View File

@@ -1,5 +1,5 @@
import { relayInfoController } from '@/controllers/nostr/relay-info.ts';
import * as eventsDB from '@/db/events.ts';
import { eventsDB } from '@/db/events.ts';
import * as pipeline from '@/pipeline.ts';
import { jsonSchema } from '@/schema.ts';
import {
@@ -63,7 +63,7 @@ function connectStream(socket: WebSocket) {
async function handleReq([_, subId, ...rest]: ClientREQ): Promise<void> {
const filters = prepareFilters(rest);
for (const event of await eventsDB.getFilters(filters, { limit: FILTER_LIMIT })) {
for (const event of await eventsDB.getEvents(filters, { limit: FILTER_LIMIT })) {
send(['EVENT', subId, event]);
}