const following = await ctx.db
.query('follows')
.withIndex('uniqueRelationship', (q) => q.eq('followerType', 'user')
.eq('followerId', ctx.user._id))
.paginate(paginationOpts);
if (following.page.length === 0) {
return {
page: [],
isDone: true,
continueCursor: undefined
};
}
const discussions = [];
for (const follow of following.page) {
const { page: discussionsPage } = await getPage(ctx,
{
table: 'discussions',
index: 'byUserOrgUniversity',
startIndexKey: [follow.followeeId],
endIndexKey: [follow.followeeId],
absoluteMaxRows: 10
});
discussions.push(...discussionsPage);
}
const following = await ctx.db
.query('follows')
.withIndex('uniqueRelationship', (q) => q.eq('followerType', 'user')
.eq('followerId', ctx.user._id))
.paginate(paginationOpts);
if (following.page.length === 0) {
return {
page: [],
isDone: true,
continueCursor: undefined
};
}
const discussions = [];
for (const follow of following.page) {
const { page: discussionsPage } = await getPage(ctx,
{
table: 'discussions',
index: 'byUserOrgUniversity',
startIndexKey: [follow.followeeId],
endIndexKey: [follow.followeeId],
absoluteMaxRows: 10
});
discussions.push(...discussionsPage);
}