fix: multiple tag queries
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Kieran 2024-03-07 13:58:56 +00:00
parent dbf2346176
commit 3153f632c7

View File

@ -243,13 +243,15 @@ export class SqliteRelay extends EventEmitter<RelayHandlerEvents> implements Rel
}
let sql = `select ${resultType} from events`;
const tags = Object.entries(req).filter(([k]) => k.startsWith("#"));
let tx = 0;
for (const [key, values] of tags) {
const vArray = values as Array<string>;
sql += ` inner join tags on events.id = tags.event_id and tags.key = ? and tags.value in (${this.#repeatParams(
sql += ` inner join tags t_${tx} on events.id = t_${tx}.event_id and t_${tx}.key = ? and t_${tx}.value in (${this.#repeatParams(
vArray.length,
)})`;
params.push(key.slice(1));
params.push(...vArray);
tx++;
}
if (req.search) {
sql += " inner join search_content on search_content.id = events.id";