db/events: fix `limit` not being applied correctly

This commit is contained in:
Alex Gleason 2023-12-05 18:22:12 -06:00
parent df7b999bfe
commit a6bf5f47cd
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 2 deletions

View File

@ -139,8 +139,8 @@ function getFilterQuery(filter: DittoFilter) {
/** Combine filter queries into a single union query. */
function getFiltersQuery(filters: DittoFilter[]) {
return filters
.map(getFilterQuery)
.reduce((result, query) => result.union(query));
.map((filter) => db.selectFrom(() => getFilterQuery(filter).as('events')).selectAll())
.reduce((result, query) => result.unionAll(query));
}
/** Get events for filters from the database. */