fix: only include parent posts in user post count
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user