EventsDB: fix domain query with authors

This commit is contained in:
Alex Gleason 2024-10-27 10:02:28 -05:00
parent 6171a321e2
commit d52e717fb2
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -321,13 +321,13 @@ class EventsDB extends NPostgres {
} }
if (domains.size) { if (domains.size) {
const query = this.opts.kysely let query = this.opts.kysely
.selectFrom('pubkey_domains') .selectFrom('pubkey_domains')
.select('pubkey') .select('pubkey')
.where('domain', 'in', [...domains]); .where('domain', 'in', [...domains]);
if (filter.authors) { if (filter.authors) {
query.where('pubkey', 'in', filter.authors); query = query.where('pubkey', 'in', filter.authors);
} }
const pubkeys = await query.execute().then((rows) => rows.map((row) => row.pubkey)); const pubkeys = await query.execute().then((rows) => rows.map((row) => row.pubkey));