Я хочу создать функцию запроса, которая динамически создает запрос. Однако я могу получить любой из элементов запроса для привязки к запросу:
Здесь я создаю наблюдаемое, где я передаю ссылку в функцию построения запроса, которая добавляет все, что мне нужно искать:
firebaseObservable = this.firestoreService.colWithIds$('bucket', ref => this.createFirebaseQuery(ref, this.filterParams.filterBy, pagination));
Здесь я строю запрос
createFirebaseQuery(ref: any, categories: string[], isPagination?: boolean) {
// Fetch the requests order by direction
const direction: OrderByDirection = this.filterParams.sortBy.direction === 'asc' ? 'asc' : 'desc';
// Add th category search criteria
for (const category of categories) {
ref.where(`categoriesTest.${category}`, '==', 'true');
}
// Order by selected type and direction
ref.orderBy(this.filterParams.sortBy.type, direction);
// Check if the requests skills are new page
if (isPagination) {
ref.startAfter(this.paginationCursor);
}
// Add a limit to the results being returned
ref.limit(20);
return ref;
}
Кажется, что к нему никогда не применяются какие-либо положения или ограничения ...?