diff --git a/src/pipeline/DVM.ts b/src/pipeline/DVM.ts index decfd0f..542aa75 100644 --- a/src/pipeline/DVM.ts +++ b/src/pipeline/DVM.ts @@ -7,10 +7,6 @@ import { eventsDB } from '@/storages.ts'; export class DVM { static async event(event: NostrEvent): Promise { - if (event.kind < 5000 || event.kind > 5999) { - throw new Error('Unsupported event kind'); - } - switch (event.kind) { case 5950: await DVM.nameRegistration(event); diff --git a/src/storages/events-db.ts b/src/storages/events-db.ts index f29137f..22d08a9 100644 --- a/src/storages/events-db.ts +++ b/src/storages/events-db.ts @@ -181,13 +181,15 @@ class EventsDB implements NStore { query = query.limit(filter.limit!); break; } + } - if (key.startsWith('#')) { - const tag = key.replace(/^#/, ''); - const value = filter[key as `#${string}`] as string[]; - query = query - .leftJoin('tags', 'tags.event_id', 'events.id') - .where('tags.tag', '=', tag) + const joinedQuery = query.leftJoin('tags', 'tags.event_id', 'events.id'); + + for (const [key, value] of Object.entries(filter)) { + if (key.startsWith('#') && Array.isArray(value)) { + const name = key.replace(/^#/, ''); + query = joinedQuery + .where('tags.tag', '=', name) .where('tags.value', 'in', value); } }