mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-09 00:08:46 +00:00
added endpoint for getting postTags and fixed follow bug
This commit is contained in:
parent
f035635df2
commit
b868bdb599
8 changed files with 92 additions and 14 deletions
|
@ -19,6 +19,7 @@ type PublicUser = {
|
|||
profilePictureUrl: string | null;
|
||||
followers: number;
|
||||
following: number;
|
||||
posts: number;
|
||||
};
|
||||
const getUser: (userId: string) => Promise<PublicUser | undefined> = async (
|
||||
userId: string
|
||||
|
@ -47,6 +48,11 @@ const getUser: (userId: string) => Promise<PublicUser | undefined> = async (
|
|||
followingUserId: userId,
|
||||
},
|
||||
});
|
||||
const postCount = await prisma.post.count({
|
||||
where: {
|
||||
userId: userId,
|
||||
},
|
||||
});
|
||||
const publicUser: PublicUser = {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
|
@ -54,6 +60,7 @@ const getUser: (userId: string) => Promise<PublicUser | undefined> = async (
|
|||
profilePictureUrl,
|
||||
followers: followerCount,
|
||||
following: followingCount,
|
||||
posts: postCount,
|
||||
};
|
||||
return publicUser;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue