Skip to main content

User Data Model Analysis

Current State Comparison

Documentation vs Seeding Script

FieldDocumentationSeeding ScriptStatus
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❌ MissingMISSING
lastLoginAt✅ Optional❌ MissingMISSING
firebaseUid✅ Optional❌ MissingMISSING
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❌ MissingMISSING
preferences✅ Optional❌ MissingMISSING
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 update
  • lastLoginAt - Should track user login activity
  • firebaseUid - Should link to Firebase Auth
  • bankingAccountAliases - Array for multiple aliases (guardians)
  • preferences - User preferences object

2. Inconsistent Field Names

  • lastActive (seeding) vs lastLoginAt (docs) - Need to standardize
  • phone location - Top level vs contactInfo.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

  1. lastActive vs lastLoginAt: 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
  2. phone location: Top level or in contactInfo?

    • Recommendation: Keep in contactInfo only (cleaner structure)
  3. timeSinceJoined type: string or number?

    • Recommendation: number (days since joined) - easier to calculate
  4. Extra fields: Keep address, verified, rating, reviews?

    • address: Keep if useful for location-based features
    • verified: Keep if needed for trust/verification system
    • rating/reviews: Keep if guardian rating system is used
  5. socialLinks type: Typed object or Record?

    • Recommendation: Typed object for type safety
  6. updatedAt: Should be required and auto-updated?

  7. firebaseUid: Should this be required or optional?

    • Recommendation: Optional (some users might not have Firebase Auth)