fix: only include parent posts in user post count

This commit is contained in:
Stevan Freeborn
2023-09-15 17:05:32 -05:00
parent 2a1b46f06d
commit 31dd29a9c2
+1
View File
@@ -154,6 +154,7 @@ export const getUserPostCount = query({
const posts = await ctx.db const posts = await ctx.db
.query('posts') .query('posts')
.withIndex('by_user_id', q => q.eq('userId', args.userId)) .withIndex('by_user_id', q => q.eq('userId', args.userId))
.filter(q => q.eq(q.field('parentPostId'), undefined))
.collect(); .collect();
return posts.length; return posts.length;