multiple queries #327
SRYVPRASAD
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
async GetUserLists(req: Request): Promise<ListEntity[] | any> {
try {
const listsByAuthor = await this.repository.whereEqualTo(e => e.author.id, req['user'].signedUid).find();
const querySnapshot = await firestore_instance
.collection('lists').where('contributors', 'array-contains-any', [
{ id: req['user'].signedUid, access: 'view', email: req['user']?.email, status: 'accepted' },
{ id: req['user'].signedUid, access: 'edit', email: req['user']?.email, status: 'accepted' }
]).get();
const listsByContributors = querySnapshot.docs.map(doc => doc.data());
const mergedLists = [...listsByAuthor, ...listsByContributors];
return mergedLists;
} catch (error) {
throw error;
}
}
Beta Was this translation helpful? Give feedback.
All reactions