mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Support querying by tags
This commit is contained in:
parent
6c96240602
commit
b408838ae0
1 changed files with 9 additions and 0 deletions
|
|
@ -58,6 +58,15 @@ async function getFilter<K extends number = number>(filter: Filter<K>): Promise<
|
|||
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)
|
||||
.where('tags.value_1', 'in', value);
|
||||
}
|
||||
}
|
||||
|
||||
const events = await query.execute();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue