The API response is 100% valid and contains real data from your database.
{
"id": "1b89f704-0157-4b7f-9974-d56de26a4d12",
"full_name": "David Nwani",
"user_name": "dave",
"email": "davidnwani0@gmail.com",
"phone": "09020971619",
"phone_verified": true,
"email_verified": true,
"dob": "1990-01-01",
"country_id": 125,
"bio": "I will take what belongs to ceasar",
"profile_image": "https://res.cloudinary.com/...",
"notification": true,
"device_type": "ANDROID",
"fcm_token": "fcmToken",
"created_at": "2025-07-30T20:10:19.000Z",
"gender": null,
"role": "user",
"country": {
"id": 125,
"name": "Nigeria"
},
"followers_count": 2,
"following_count": 2,
"bonds_count": 3,
"activities_count": 3
}- Source:
userstable - Status: All fields retrieved correctly from database
- Includes: personal info, verification status, preferences
- Source:
countriestable (JOIN) - Status: Correctly resolved via
country_idrelationship - Returns:
{ id: 125, name: "Nigeria" }
- Source:
followstable - Query:
SELECT COUNT(*) FROM follows WHERE following_id = ? - Result: 2 users are following this user
- Source:
followstable - Query:
SELECT COUNT(*) FROM follows WHERE follower_id = ? - Result: This user is following 2 other users
- Source:
bonds_userstable - Query:
SELECT COUNT(*) FROM bonds_users WHERE user_id = ? - Result: User is a member of 3 bonds
- Source: Multiple activity tables (UNION query)
activity_participants- Regular participantsactivity_co_organizers- Co-organizersactivities.creator_id- Activities created by user
- Query: UNION of all three sources with DISTINCT count
- Result: User is participating in/organizing 3 activities
- Previous Issue: Was querying non-existent
activity_attendeestable (500 error) - Fix Applied: Changed to correct table names
File: /src/modules/user/user.service.ts
Before (causing 500 error):
SELECT COUNT(DISTINCT activity_id) as count
FROM activity_attendees
WHERE user_id = ?After (working correctly):
SELECT COUNT(DISTINCT activity_id) as count FROM (
SELECT activity_id FROM activity_participants WHERE user_id = ?
UNION
SELECT activity_id FROM activity_co_organizers WHERE user_id = ?
UNION
SELECT id as activity_id FROM activities WHERE creator_id = ?
) AS user_activitiesFile: /src/modules/user/dto/user-response.dto.ts
Added missing fields and proper Swagger documentation:
phone_verified- Phone verification statusgender- User genderrole- User role (user/admin)- Added
@ApiPropertydecorators to all exposed fields
✅ All data is authentic and accurately retrieved from your database
✅ No fabricated or placeholder data
✅ API is fully functional after the fix
✅ Swagger documentation now matches actual response
curl -X 'GET' \
'http://localhost:3001/user/1b89f704-0157-4b7f-9974-d56de26a4d12' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'- Status:
200 OK - All user fields populated
- Accurate counts for followers, following, bonds, activities
- Country properly resolved