-
id
: Unique identifier (UUID)
-
name
: Full name of the user
-
email
: Unique email address
-
passwordHash
: Encrypted password
-
profileImage
: Avatar URL
-
globalRole
: System-wide role (e.g., Admin, Regular)
-
teams
: List of team IDs the user belongs to
-
createdTeams
: Teams owned by this user
-
createdAt
: Date of registration
-
lastActiveAt
: Last activity timestamp
MongoDB Schema (Mongoose)
const UserSchema = new Schema({
name: String,
email: { type: String, unique: true },
passwordHash: String,
profileImage: String,
globalRole: { type: String, default: 'User' },
teams: [{ type: Schema.Types.ObjectId, ref: 'Team' }],
createdTeams: [{ type: Schema.Types.ObjectId, ref: 'Team' }],
createdAt: { type: Date, default: Date.now },
lastActiveAt: Date
});
- Password hashing handled with
bcrypt
- Email must be verified for activation