User Data Model Analysis
Current State Comparison
Documentation vs Seeding Script
| Field | Documentation | Seeding Script | Status |
|---|---|---|---|
id | ✅ Required | ✅ Required | ✅ Match |
email | ✅ Required | ✅ Required | ✅ Match |
name | ✅ Required | ✅ Required | ✅ Match |
role | ✅ Required | ✅ Required | ✅ Match |
status | ✅ Required | ✅ Required | ✅ Match |
imageUrl | ✅ Optional | ✅ Optional | ✅ Match |
createdAt | ✅ Required | ✅ Required | ✅ Match |
updatedAt | ✅ Required | ❌ Missing | ❌ MISSING |
lastLoginAt | ✅ Optional | ❌ Missing | ❌ MISSING |
firebaseUid | ✅ Optional | ❌ Missing | ❌ MISSING |
bio | ✅ Optional | ✅ Optional | ✅ Match |
location | ✅ Optional | ✅ Optional | ✅ Match |
phone | ✅ Optional (top level) | ❌ Only in contactInfo | ⚠️ INCONSISTENT |
organization | ✅ Optional | ✅ Optional | ✅ Match |
department | ✅ Optional | ✅ Optional | ✅ Match |
timeSinceJoined | ✅ Optional (string) | ✅ Optional (number) | ⚠️ TYPE MISMATCH |
activityRate | ✅ Optional | ✅ Optional | ✅ Match |
permissions | ✅ Optional | ✅ Optional | ✅ Match |
contactInfo.phone | ✅ Optional | ✅ Optional | ✅ Match |
contactInfo.website | ✅ Optional | ✅ Optional | ✅ Match |
contactInfo.socialLinks | ✅ Typed object | ⚠️ Record<string, string> | ⚠️ TYPE MISMATCH |
bankingAccountAlias | ✅ Optional | ✅ Optional | ✅ Match |
bankingAccountAliases | ✅ Optional | ❌ Missing | ❌ MISSING |
preferences | ✅ Optional | ❌ Missing | ❌ MISSING |
address | ❌ Not in docs | ✅ Optional | ⚠️ EXTRA FIELD |
verified | ❌ Not in docs | ✅ Required | ⚠️ EXTRA FIELD |
rating | ❌ Not in docs | ✅ Required | ⚠️ EXTRA FIELD |
reviews | ❌ Not in docs | ✅ Required | ⚠️ EXTRA FIELD |
lastActive | ❌ Not in docs | ✅ Required | ⚠️ EXTRA FIELD |
Issues Identified
1. Missing Required Fields
updatedAt- Should be set on every updatelastLoginAt- Should track user login activityfirebaseUid- Should link to Firebase AuthbankingAccountAliases- Array for multiple aliases (guardians)preferences- User preferences object
2. Inconsistent Field Names
lastActive(seeding) vslastLoginAt(docs) - Need to standardizephonelocation - Top level vscontactInfo.phone- Need to decide
3. Type Mismatches
timeSinceJoined: string (docs) vs number (seeding) - Should be number (days)socialLinks: Typed object (docs) vs Record (seeding) - Should be typed
4. Extra Fields in Seeding
address- Should this be kept or removed?verified- Should this be kept or removed?rating- Should this be kept or removed?reviews- Should this be kept or removed?
Questions to Resolve
-
lastActivevslastLoginAt: Which should we use?lastActive= Last time user was active (broader)lastLoginAt= Last time user logged in (specific)- Recommendation: Use
lastActive(more useful) and rename docs
-
phonelocation: Top level or incontactInfo?- Recommendation: Keep in
contactInfoonly (cleaner structure)
- Recommendation: Keep in
-
timeSinceJoinedtype: string or number?- Recommendation: number (days since joined) - easier to calculate
-
Extra fields: Keep
address,verified,rating,reviews?address: Keep if useful for location-based featuresverified: Keep if needed for trust/verification systemrating/reviews: Keep if guardian rating system is used
-
socialLinkstype: Typed object or Record?- Recommendation: Typed object for type safety
-
updatedAt: Should be required and auto-updated? -
firebaseUid: Should this be required or optional?- Recommendation: Optional (some users might not have Firebase Auth)