feat(social/profile): approvedDomainsCount in foreign-profile response

Frontend Foreign-Profile-Page rendert 3 Stat-Cards (Posts/Followers/
Approved) — counter für approved DomainSubmissions hat im Endpoint
gefehlt → undefined im UI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-18 03:45:17 +02:00
parent c6e2116084
commit bca00e03a5

View File

@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
currentUserId = u.id; currentUserId = u.id;
} catch {} } catch {}
const [profile, score, followRelation, recentPosts, metaMap, postsCount, followingCount] = const [profile, score, followRelation, recentPosts, metaMap, postsCount, followingCount, approvedDomainsCount] =
await Promise.all([ await Promise.all([
getProfile(targetUserId), getProfile(targetUserId),
getUserScore(targetUserId), getUserScore(targetUserId),
@ -44,6 +44,9 @@ export default defineEventHandler(async (event) => {
usePrisma().userFollow.count({ usePrisma().userFollow.count({
where: { followerId: targetUserId }, where: { followerId: targetUserId },
}), }),
usePrisma().domainSubmission.count({
where: { userId: targetUserId, status: "approved" },
}),
]); ]);
if (!profile) if (!profile)
@ -60,6 +63,7 @@ export default defineEventHandler(async (event) => {
followersCount: profile.followersCount ?? 0, followersCount: profile.followersCount ?? 0,
followingCount, followingCount,
postsCount, postsCount,
approvedDomainsCount,
tier: score?.tier ?? "beginner", tier: score?.tier ?? "beginner",
totalPoints: score?.totalPoints ?? 0, totalPoints: score?.totalPoints ?? 0,
isFollowing: !!followRelation, isFollowing: !!followRelation,