feat: add ability to follow and unfollow a user on their profile page

This commit is contained in:
Stevan Freeborn
2023-09-15 17:02:20 -05:00
parent bc86873d89
commit 2a1b46f06d
6 changed files with 221 additions and 14 deletions
+12
View File
@@ -147,3 +147,15 @@ export const getPostReplyCount = query({
return replies.length;
},
});
export const getUserPostCount = query({
args: { userId: v.id('users') },
handler: async (ctx, args) => {
const posts = await ctx.db
.query('posts')
.withIndex('by_user_id', q => q.eq('userId', args.userId))
.collect();
return posts.length;
},
});